Skip to content

Instantly share code, notes, and snippets.

@siddontang
Last active June 12, 2022 10:02
Show Gist options
  • Save siddontang/31282a47aa7b9cce1f0b74227cc21037 to your computer and use it in GitHub Desktop.
Save siddontang/31282a47aa7b9cce1f0b74227cc21037 to your computer and use it in GitHub Desktop.
Run Corteza(https://cortezaproject.org/) on TiDB

Start TiDB

tiup --tag 6.0 playground 6.0

Create Corteza database and account

Connect to TiDB

mysql -h 127.0.0.1 -P 4000 -uroot -p

Set SQL Mode

SET GLOBAL sql_mode = 'ansi';

Create the Corteza account

CREATE DATABASE corteza;
CREATE USER 'corteza' IDENTIFIED BY 'corteza';
GRANT ALL PRIVILEGES ON corteza.* TO 'corteza';
FLUSH PRIVILEGES;

Create tables for Corteza

The corteza.sql is in the Attachment section.

mysql -h 127.0.0.1 -P 4000 -uroot -D corteza -p < corteza.sql

Create a .env file

DOMAIN=local.cortezaproject.org:18080
VERSION=2022.3.0

DB_DSN=mysql://corteza:corteza@tcp(host.docker.internal:4000)/corteza?collation=utf8mb4_general_ci
HTTP_WEBAPP_ENABLED=true
ACTIONLOG_ENABLED=false

Creata a docker-compose.yml file

The docker-compose.yml and .env must be in the same directory

version: '3.5'

services:
  server:
    image: cortezaproject/corteza:${VERSION}
    restart: always
    env_file: [ .env ]
    ports: [ "127.0.0.1:18080:80" ]

Start corteza server

docker-compose up -d

Access http://127.0.0.1:18080 and enjoy it

Attachment

corteza.sql
CREATE TABLE `actionlog` (
  `id` bigint(20) unsigned NOT NULL,
  `ts` datetime NOT NULL,
  `actor_ip_addr` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `actor_id` bigint(20) unsigned NOT NULL,
  `request_origin` varchar(32) COLLATE utf8_general_ci NOT NULL,
  `request_id` varchar(256) COLLATE utf8_general_ci NOT NULL,
  `resource` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `action` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `error` text COLLATE utf8_general_ci NOT NULL,
  `severity` int(11) NOT NULL,
  `description` text COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `ts` (`ts`),
  KEY `request_origin` (`request_origin`),
  KEY `actor_id` (`actor_id`),
  KEY `resource` (`resource`),
  KEY `action` (`action`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `apigw_filters` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_route` bigint(20) unsigned NOT NULL,
  `weight` int(11) NOT NULL,
  `kind` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `ref` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `params` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `apigw_routes` (
  `id` bigint(20) unsigned NOT NULL,
  `endpoint` text COLLATE utf8_general_ci NOT NULL,
  `method` text COLLATE utf8_general_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `meta` json NOT NULL,
  `rel_group` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `applications` (
  `id` bigint(20) unsigned NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL DEFAULT '1',
  `weight` int(11) NOT NULL DEFAULT '0',
  `unify` json NOT NULL,
  `rel_owner` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `attachments` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_owner` bigint(20) unsigned NOT NULL,
  `kind` text COLLATE utf8_general_ci NOT NULL,
  `url` text COLLATE utf8_general_ci NOT NULL,
  `preview_url` text COLLATE utf8_general_ci NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `auth_clients` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `secret` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `scope` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `valid_grant` varchar(32) COLLATE utf8_general_ci NOT NULL,
  `redirect_uri` text COLLATE utf8_general_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `trusted` tinyint(1) NOT NULL,
  `valid_from` datetime DEFAULT NULL,
  `expires_at` datetime DEFAULT NULL,
  `security` json NOT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `auth_confirmed_clients` (
  `rel_user` bigint(20) unsigned NOT NULL,
  `rel_client` bigint(20) unsigned NOT NULL,
  `confirmed_at` datetime NOT NULL,
  PRIMARY KEY (`rel_user`,`rel_client`) /*T![clustered_index] NONCLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `auth_oa2tokens` (
  `id` bigint(20) unsigned NOT NULL,
  `code` varchar(48) COLLATE utf8_general_ci NOT NULL,
  `access` varchar(2048) COLLATE utf8_general_ci NOT NULL,
  `refresh` varchar(48) COLLATE utf8_general_ci NOT NULL,
  `data` json NOT NULL,
  `remote_addr` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `user_agent` text COLLATE utf8_general_ci NOT NULL,
  `rel_client` bigint(20) unsigned NOT NULL,
  `rel_user` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `expires_at` datetime NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `expires_at` (`expires_at`),
  KEY `code` (`code`),
  KEY `access` (`access`(1024)),
  KEY `refresh` (`refresh`),
  KEY `client` (`rel_client`),
  KEY `user` (`rel_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `auth_sessions` (
  `id` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `data` blob NOT NULL,
  `rel_user` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `expires_at` datetime NOT NULL,
  `remote_addr` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `user_agent` text COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] NONCLUSTERED */,
  KEY `expires_at` (`expires_at`),
  KEY `user` (`rel_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `automation_sessions` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_workflow` bigint(20) unsigned NOT NULL,
  `status` int(11) NOT NULL,
  `event_type` text COLLATE utf8_general_ci NOT NULL,
  `resource_type` text COLLATE utf8_general_ci NOT NULL,
  `input` json NOT NULL,
  `output` json NOT NULL,
  `stacktrace` json NOT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `purge_at` datetime DEFAULT NULL,
  `suspended_at` datetime DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `error` text COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `workflow` (`rel_workflow`),
  KEY `event_type` (`event_type`(64)),
  KEY `resource_type` (`resource_type`(64)),
  KEY `status` (`status`),
  KEY `created_at` (`created_at`),
  KEY `completed_at` (`completed_at`),
  KEY `suspended_at` (`suspended_at`),
  KEY `automation_sessions_event_type` (`event_type`(64)),
  KEY `automation_sessions_resource_type` (`resource_type`(64)),
  KEY `automation_sessions_status` (`status`),
  KEY `automation_sessions_created_at` (`created_at`),
  KEY `automation_sessions_completed_at` (`completed_at`),
  KEY `automation_sessions_suspended_at` (`suspended_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `automation_triggers` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_workflow` bigint(20) unsigned NOT NULL,
  `rel_step` bigint(20) unsigned NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `meta` json NOT NULL,
  `resource_type` text COLLATE utf8_general_ci NOT NULL,
  `event_type` text COLLATE utf8_general_ci NOT NULL,
  `constraints` json NOT NULL,
  `input` json NOT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `workflow` (`rel_workflow`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `automation_workflows` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `trace` tinyint(1) NOT NULL,
  `keep_sessions` int(11) NOT NULL,
  `scope` json NOT NULL,
  `steps` json NOT NULL,
  `paths` json NOT NULL,
  `issues` json NOT NULL,
  `run_as` bigint(20) unsigned NOT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_attachment` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_namespace` bigint(20) unsigned NOT NULL,
  `rel_owner` bigint(20) unsigned NOT NULL,
  `kind` text COLLATE utf8_general_ci NOT NULL,
  `url` text COLLATE utf8_general_ci NOT NULL,
  `preview_url` text COLLATE utf8_general_ci NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `namespace` (`rel_namespace`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_chart` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `rel_namespace` bigint(20) unsigned NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `config` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `namespace` (`rel_namespace`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_module` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_namespace` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `model_config` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `namespace` (`rel_namespace`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_module_field` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_module` bigint(20) unsigned NOT NULL,
  `place` int(11) NOT NULL,
  `kind` text COLLATE utf8_general_ci NOT NULL,
  `options` json NOT NULL,
  `encoding_strategy` json NOT NULL,
  `default_value` json NOT NULL,
  `expressions` json NOT NULL,
  `name` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `label` text COLLATE utf8_general_ci NOT NULL,
  `is_private` tinyint(1) NOT NULL,
  `is_required` tinyint(1) NOT NULL,
  `is_visible` tinyint(1) NOT NULL,
  `is_multi` tinyint(1) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `module` (`rel_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_namespace` (
  `id` bigint(20) unsigned NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `slug` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `meta` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_page` (
  `id` bigint(20) unsigned NOT NULL,
  `title` text COLLATE utf8_general_ci NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `description` text COLLATE utf8_general_ci NOT NULL,
  `rel_namespace` bigint(20) unsigned NOT NULL,
  `rel_module` bigint(20) unsigned NOT NULL,
  `self_id` bigint(20) unsigned NOT NULL,
  `config` json NOT NULL,
  `blocks` json NOT NULL,
  `visible` tinyint(1) NOT NULL,
  `weight` int(11) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `self` (`self_id`),
  KEY `namespace` (`rel_namespace`),
  KEY `module` (`rel_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_record` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_namespace` bigint(20) unsigned NOT NULL,
  `module_id` bigint(20) unsigned NOT NULL,
  `values` json NOT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `namespace` (`rel_namespace`),
  KEY `module` (`module_id`),
  KEY `owner` (`owned_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `compose_record_value` (
  `record_id` bigint(20) unsigned NOT NULL,
  `name` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `value` longtext COLLATE utf8_general_ci NOT NULL,
  `ref` bigint(20) unsigned NOT NULL,
  `place` int(11) NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`record_id`,`name`,`place`) /*T![clustered_index] NONCLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `connections` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `dsn` varchar(2048) COLLATE utf8_general_ci NOT NULL,
  `location` text COLLATE utf8_general_ci NOT NULL,
  `ownership` text COLLATE utf8_general_ci NOT NULL,
  `sensitive` tinyint(1) NOT NULL,
  `config` json NOT NULL,
  `capabilities` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `credentials` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_owner` bigint(20) unsigned NOT NULL,
  `label` text COLLATE utf8_general_ci NOT NULL,
  `kind` varchar(128) COLLATE utf8_general_ci NOT NULL,
  `credentials` text COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `expires_at` datetime DEFAULT NULL,
  `last_used_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `federation_module_exposed` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `rel_node` bigint(20) unsigned NOT NULL,
  `rel_compose_module` bigint(20) unsigned NOT NULL,
  `rel_compose_namespace` bigint(20) unsigned NOT NULL,
  `fields` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `unique_node_compose_module` (`rel_node`,`rel_compose_module`,`rel_compose_namespace`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `federation_module_mapping` (
  `rel_federation_module` bigint(20) unsigned NOT NULL,
  `rel_compose_module` bigint(20) unsigned NOT NULL,
  `rel_compose_namespace` bigint(20) unsigned NOT NULL,
  `field_mapping` json NOT NULL,
  UNIQUE KEY `unique_module_compose_module` (`rel_federation_module`,`rel_compose_module`,`rel_compose_namespace`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `federation_module_shared` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `rel_node` bigint(20) unsigned NOT NULL,
  `xref_module` bigint(20) unsigned NOT NULL,
  `fields` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `federation_nodes` (
  `id` bigint(20) unsigned NOT NULL,
  `shared_node_id` bigint(20) unsigned NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `base_url` text COLLATE utf8_general_ci NOT NULL,
  `status` text COLLATE utf8_general_ci NOT NULL,
  `contact` varchar(254) COLLATE utf8_general_ci NOT NULL,
  `pair_token` text COLLATE utf8_general_ci NOT NULL,
  `auth_token` text COLLATE utf8_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `federation_nodes_sync` (
  `rel_node` bigint(20) unsigned NOT NULL,
  `rel_module` bigint(20) unsigned NOT NULL,
  `sync_type` text COLLATE utf8_general_ci NOT NULL,
  `sync_status` text COLLATE utf8_general_ci NOT NULL,
  `time_action` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `flags` (
  `kind` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `rel_resource` bigint(20) unsigned NOT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `name` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  UNIQUE KEY `unique_kind_res_owner_name` (`kind`,`rel_resource`,`owned_by`,(lower(`name`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `labels` (
  `kind` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `rel_resource` bigint(20) unsigned NOT NULL,
  `name` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `value` text COLLATE utf8_general_ci NOT NULL,
  UNIQUE KEY `unique_kind_res_name` (`kind`,`rel_resource`,(lower(`name`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `queue_messages` (
  `id` bigint(20) unsigned NOT NULL,
  `queue` text COLLATE utf8_general_ci NOT NULL,
  `payload` blob NOT NULL,
  `created` datetime NOT NULL,
  `processed` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `queue_settings` (
  `id` bigint(20) unsigned NOT NULL,
  `consumer` text COLLATE utf8_general_ci NOT NULL,
  `queue` text COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `rbac_rules` (
  `rel_role` bigint(20) unsigned NOT NULL,
  `resource` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `operation` varchar(50) COLLATE utf8_general_ci NOT NULL,
  `access` int(11) NOT NULL,
  PRIMARY KEY (`rel_role`,`resource`,`operation`) /*T![clustered_index] NONCLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `reminders` (
  `id` bigint(20) unsigned NOT NULL,
  `resource` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `payload` json NOT NULL,
  `snooze_count` int(11) NOT NULL DEFAULT '0',
  `assigned_to` bigint(20) unsigned NOT NULL DEFAULT '0',
  `assigned_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `assigned_at` datetime NOT NULL,
  `remind_at` datetime DEFAULT NULL,
  `dismissed_at` datetime DEFAULT NULL,
  `dismissed_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `resource` (`resource`),
  KEY `assignee` (`assigned_to`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `reports` (
  `id` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `scenarios` json NOT NULL,
  `sources` json NOT NULL,
  `blocks` json NOT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `resource_activity_log` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_resource` bigint(20) unsigned NOT NULL,
  `resource_type` text COLLATE utf8_general_ci NOT NULL,
  `resource_action` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `ts` datetime NOT NULL,
  `meta` json NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `rel_resource` (`rel_resource`),
  KEY `ts` (`ts`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `resource_translations` (
  `id` bigint(20) unsigned NOT NULL,
  `lang` varchar(128) COLLATE utf8_general_ci NOT NULL,
  `resource` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `k` varchar(256) COLLATE utf8_general_ci NOT NULL,
  `message` text COLLATE utf8_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `owned_by` bigint(20) unsigned NOT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  `deleted_by` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `unique_translation` ((lower(`lang`)),(lower(`resource`)),(lower(`k`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `role_members` (
  `rel_role` bigint(20) unsigned NOT NULL,
  `rel_user` bigint(20) unsigned NOT NULL,
  UNIQUE KEY `unique_membership` (`rel_role`,`rel_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `archived_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `settings` (
  `rel_owner` bigint(20) unsigned NOT NULL,
  `name` varchar(512) COLLATE utf8_general_ci NOT NULL,
  `value` json NOT NULL,
  `updated_by` bigint(20) unsigned NOT NULL,
  `updated_at` datetime NOT NULL,
  UNIQUE KEY `unique_name` ((lower(`name`)),`rel_owner`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `templates` (
  `id` bigint(20) unsigned NOT NULL,
  `rel_owner` bigint(20) unsigned NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `language` text COLLATE utf8_general_ci NOT NULL,
  `type` text COLLATE utf8_general_ci NOT NULL,
  `partial` tinyint(1) NOT NULL,
  `meta` json NOT NULL,
  `template` text COLLATE utf8_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `last_used_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL,
  `email` varchar(254) COLLATE utf8_general_ci NOT NULL,
  `email_confirmed` tinyint(1) NOT NULL DEFAULT '0',
  `username` text COLLATE utf8_general_ci NOT NULL,
  `name` text COLLATE utf8_general_ci NOT NULL,
  `handle` varchar(64) COLLATE utf8_general_ci NOT NULL,
  `kind` varchar(8) COLLATE utf8_general_ci NOT NULL,
  `meta` json NOT NULL,
  `suspended_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment