From e26471ca8bb04da9f348ccae2fffc6b75e06131a Mon Sep 17 00:00:00 2001 From: BlankParticle Date: Sun, 25 Aug 2024 17:18:05 +0530 Subject: [PATCH] fix: make database migrations work --- .env.local.example | 1 - package.json | 4 +- packages/database/drizzle.config.ts | 6 +- packages/database/env.ts | 2 - packages/database/index.ts | 7 +- packages/database/migrate.ts | 7 +- .../migrations/0000_cultured_cable.sql | 731 +++ .../0000_talented_wendell_vaughn.sql | 7 - .../migrations/0001_confused_black_knight.sql | 239 - .../migrations/0002_condemned_cyclops.sql | 1 - .../migrations/meta/0000_snapshot.json | 4492 +++++++++------- .../migrations/meta/0001_snapshot.json | 4725 ---------------- .../migrations/meta/0002_snapshot.json | 4733 ----------------- .../database/migrations/meta/_journal.json | 20 +- packages/database/package.json | 21 +- packages/database/postPush.ts | 16 - packages/database/schema.ts | 31 +- 17 files changed, 3448 insertions(+), 11595 deletions(-) create mode 100644 packages/database/migrations/0000_cultured_cable.sql delete mode 100644 packages/database/migrations/0000_talented_wendell_vaughn.sql delete mode 100644 packages/database/migrations/0001_confused_black_knight.sql delete mode 100644 packages/database/migrations/0002_condemned_cyclops.sql delete mode 100644 packages/database/migrations/meta/0001_snapshot.json delete mode 100644 packages/database/migrations/meta/0002_snapshot.json delete mode 100644 packages/database/postPush.ts diff --git a/.env.local.example b/.env.local.example index 9ece11ff..e2d7336c 100644 --- a/.env.local.example +++ b/.env.local.example @@ -82,7 +82,6 @@ DB_PLANETSCALE_DATABASE=planetscale DB_PLANETSCALE_HOST=localhost:3900 DB_PLANETSCALE_USERNAME=root DB_PLANETSCALE_PASSWORD=planetscale -DB_PLANETSCALE_DATABASE=planetscale DB_REDIS_CONNECTION_STRING="redis://localhost:3901" diff --git a/package.json b/package.json index 13060fa6..b180b379 100644 --- a/package.json +++ b/package.json @@ -38,17 +38,17 @@ "db:push": "dotenv -e .env.local -- pnpm --dir packages/database db:push", "db:studio": "dotenv -e .env.local -- turbo run db:studio", "db:generate": "dotenv -e .env.local -- turbo run db:generate", + "db:migrate": "dotenv -e .env.local -- turbo run db:migrate", "db:up": "dotenv -e .env.local -- turbo run db:up", "db:check": "dotenv -e .env.local -- turbo run db:generate", "db:drop": "dotenv -e .env.local -- turbo run db:drop", "start:all:r": "infisical run --env=remote -- turbo run start", "dev:r": "infisical run --env=remote -- turbo run dev", "dev:spaces": "infisical run --env=spacesremote -- turbo run dev", - "db:push:r": "infisical run --env=remote -- pnpm --dir packages/database db:push:r", + "db:push:r": "infisical run --env=remote -- pnpm --dir packages/database db:push", "db:studio:r": "infisical run --env=remote -- turbo run db:studio", "db:generate:r": "infisical run --env=remote -- turbo run db:generate", "db:up:r": "infisical run --env=remote -- turbo run db:up", - "db:check:r": "infisical run --env=remote -- turbo run db:generate", "db:drop:r": "infisical run --env=remote -- turbo run db:drop", "ee:dev:r": "infisical run --env=remote -- turbo run ee:dev", "ee:check": "infisical run --env=remote -- turbo run ee:check", diff --git a/packages/database/drizzle.config.ts b/packages/database/drizzle.config.ts index bd697300..359cf432 100644 --- a/packages/database/drizzle.config.ts +++ b/packages/database/drizzle.config.ts @@ -1,11 +1,11 @@ -import type { Config } from 'drizzle-kit'; +import { defineConfig } from 'drizzle-kit'; import { env } from './env'; -export default { +export default defineConfig({ schema: './schema.ts', out: './migrations', dialect: 'mysql', dbCredentials: { url: env.DB_MYSQL_MIGRATION_URL } -} satisfies Config; +}); diff --git a/packages/database/env.ts b/packages/database/env.ts index 77611430..4b7508d2 100644 --- a/packages/database/env.ts +++ b/packages/database/env.ts @@ -8,7 +8,5 @@ export const env = createEnv({ DB_PLANETSCALE_PASSWORD: z.string().min(1), DB_MYSQL_MIGRATION_URL: z.string().min(1) }, - client: {}, - clientPrefix: '_', // Not used, just for making TS happy runtimeEnv: process.env }); diff --git a/packages/database/index.ts b/packages/database/index.ts index 28a67d6d..2d58baac 100644 --- a/packages/database/index.ts +++ b/packages/database/index.ts @@ -51,10 +51,5 @@ const client = new Client({ } }); -const connectionOptions = { - logger: false, - schema -}; - -export const db = drizzle(client, connectionOptions); +export const db = drizzle(client, { schema }); export type DBType = typeof db; diff --git a/packages/database/migrate.ts b/packages/database/migrate.ts index 5fa038f1..797528e0 100644 --- a/packages/database/migrate.ts +++ b/packages/database/migrate.ts @@ -3,10 +3,7 @@ import { createConnection } from 'mysql2/promise'; import { drizzle } from 'drizzle-orm/mysql2'; import { env } from './env'; -const connection = await createConnection({ - uri: env.DB_MYSQL_MIGRATION_URL -}); -const db = drizzle(connection); - +const connection = await createConnection({ uri: env.DB_MYSQL_MIGRATION_URL }); +const db = drizzle(connection, { mode: 'planetscale', logger: true }); await migrate(db, { migrationsFolder: 'migrations' }); await connection.end(); diff --git a/packages/database/migrations/0000_cultured_cable.sql b/packages/database/migrations/0000_cultured_cable.sql new file mode 100644 index 00000000..5eea2efc --- /dev/null +++ b/packages/database/migrations/0000_cultured_cable.sql @@ -0,0 +1,731 @@ +CREATE TABLE `account_credentials` ( + `id` serial AUTO_INCREMENT NOT NULL, + `account_id` bigint unsigned NOT NULL, + `password_hash` varchar(255), + `two_factor_secret` varchar(255), + `two_factor_enabled` boolean NOT NULL DEFAULT false, + `recovery_code` varchar(256), + CONSTRAINT `account_credentials_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `accounts` ( + `id` serial AUTO_INCREMENT NOT NULL, + `public_id` char(28) NOT NULL, + `username` varchar(32) NOT NULL, + `metadata` json, + `created_at` timestamp, + `last_login_at` timestamp, + `password_hash` varchar(255), + `recovery_email_hash` varchar(255), + `recovery_email_verified_at` timestamp, + `two_factor_secret` varchar(255), + `two_factor_enabled` boolean NOT NULL DEFAULT false, + `recovery_code` varchar(256), + `pre_account` boolean NOT NULL DEFAULT true, + CONSTRAINT `accounts_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `username_idx` UNIQUE(`username`) +); +--> statement-breakpoint +CREATE TABLE `authenticators` ( + `id` serial AUTO_INCREMENT NOT NULL, + `public_id` char(29) NOT NULL, + `account_credential_id` bigint unsigned NOT NULL, + `account_id` bigint unsigned NOT NULL, + `nickname` varchar(64) NOT NULL, + `credential_id` varchar(255) NOT NULL, + `credential_public_key` text NOT NULL, + `counter` bigint unsigned NOT NULL, + `credential_device_type` varchar(32) NOT NULL, + `credential_backed_up` boolean NOT NULL, + `transports` json, + `created_at` timestamp NOT NULL, + CONSTRAINT `authenticators_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `credential_id_idx` UNIQUE(`credential_id`) +); +--> statement-breakpoint +CREATE TABLE `contact_global_reputations` ( + `id` serial AUTO_INCREMENT NOT NULL, + `email_address` varchar(128) NOT NULL, + `spam` tinyint NOT NULL DEFAULT 0, + `cold` tinyint NOT NULL DEFAULT 0, + `newsletter` tinyint NOT NULL DEFAULT 0, + `marketing` tinyint NOT NULL DEFAULT 0, + `product` tinyint NOT NULL DEFAULT 0, + `message_count` mediumint NOT NULL DEFAULT 0, + `last_updated` timestamp NOT NULL, + CONSTRAINT `contact_global_reputations_id` PRIMARY KEY(`id`), + CONSTRAINT `email_address_idx` UNIQUE(`email_address`) +); +--> statement-breakpoint +CREATE TABLE `contacts` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(28) NOT NULL, + `avatar_timestamp` timestamp, + `reputation_id` bigint unsigned NOT NULL, + `name` varchar(128), + `set_name` varchar(128), + `email_username` varchar(128) NOT NULL, + `email_domain` varchar(128) NOT NULL, + `signature` text, + `signature_html` text, + `type` enum('person','product','newsletter','marketing','unknown') NOT NULL, + `screener_status` enum('pending','approve','reject'), + `created_at` timestamp NOT NULL, + CONSTRAINT `contacts_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `email_org_unique_idx` UNIQUE(`email_username`,`email_domain`,`org_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_attachments` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `convo_entry_id` bigint unsigned, + `fileName` varchar(256) NOT NULL, + `type` varchar(256) NOT NULL, + `size` int unsigned NOT NULL, + `inline` boolean NOT NULL DEFAULT false, + `public` boolean NOT NULL DEFAULT false, + `convo_participant_id` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_attachments_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_entries` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `type` enum('message','comment','draft') NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `subject_id` bigint unsigned, + `author` bigint unsigned NOT NULL, + `reply_to_id` bigint unsigned, + `body` json NOT NULL, + `body_plain_text` longtext NOT NULL, + `body_cleaned_html` longtext, + `metadata` json DEFAULT ('{}'), + `email_message_id` varchar(255) GENERATED ALWAYS AS (JSON_UNQUOTE(metadata-> '$.email.messageId')) STORED, + `visibility` enum('private','internal_participants','org','all_participants') NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_entries_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_entry_private_visibility_participants` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `entry_id` bigint unsigned NOT NULL, + `convo_member_id` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_entry_private_visibility_participants_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `convo_entry_raw_html_emails` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `entry_id` bigint unsigned NOT NULL, + `headers` json NOT NULL, + `html` mediumtext NOT NULL, + `wipe_date` timestamp NOT NULL, + `keep` boolean NOT NULL DEFAULT false, + `wiped` boolean NOT NULL DEFAULT false, + CONSTRAINT `convo_entry_raw_html_emails_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `convo_entry_replies` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `convo_message_source_id` bigint unsigned NOT NULL, + `convo_message_reply_id` bigint unsigned, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_entry_replies_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `convo_entry_seen_timestamps` ( + `org_id` bigint unsigned NOT NULL, + `convo_entry_id` bigint unsigned NOT NULL, + `participant_id` bigint unsigned NOT NULL, + `org_member_id` bigint unsigned NOT NULL, + `seen_at` timestamp NOT NULL, + CONSTRAINT `id` PRIMARY KEY(`convo_entry_id`,`participant_id`,`org_member_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_participant_team_members` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `convo_participant_id` bigint unsigned NOT NULL, + `team_id` bigint unsigned NOT NULL, + CONSTRAINT `convo_participant_team_members_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `convo_participants` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `org_member_id` bigint unsigned, + `team_id` bigint unsigned, + `contact_id` bigint unsigned, + `convo_id` bigint unsigned NOT NULL, + `role` enum('assigned','contributor','commenter','watcher','teamMember','guest') NOT NULL DEFAULT 'contributor', + `email_identity_id` bigint unsigned, + `notifications` enum('active','muted','off') NOT NULL DEFAULT 'active', + `last_read_at` timestamp, + `active` boolean NOT NULL DEFAULT true, + `hidden` boolean NOT NULL DEFAULT false, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_participants_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `team_to_convo_idx` UNIQUE(`convo_id`,`team_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_seen_timestamps` ( + `org_id` bigint unsigned NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `participant_id` bigint unsigned NOT NULL, + `org_member_id` bigint unsigned NOT NULL, + `seen_at` timestamp NOT NULL, + CONSTRAINT `id` PRIMARY KEY(`convo_id`,`participant_id`,`org_member_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_subjects` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `subject` varchar(256) NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_subjects_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_tags` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(30) NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `space_id` bigint unsigned NOT NULL, + `convo_to_space_id` bigint unsigned NOT NULL, + `tag_id` bigint unsigned NOT NULL, + `added_by_org_member_id` bigint unsigned NOT NULL, + `added_at` timestamp NOT NULL, + CONSTRAINT `convo_tags_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_to_spaces` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(30) NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `space_id` bigint unsigned NOT NULL, + CONSTRAINT `convo_to_spaces_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `convo_workflows` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `convo_id` bigint unsigned NOT NULL, + `space_id` bigint unsigned NOT NULL, + `convo_to_space_id` bigint unsigned NOT NULL, + `workflow_id` bigint unsigned, + `by_org_member_id` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `convo_workflows_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `convos` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(28) NOT NULL, + `last_updated_at` timestamp NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `convos_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `domains` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `disabled` boolean NOT NULL DEFAULT false, + `public_id` char(30) NOT NULL, + `catch_all_address` bigint unsigned, + `postal_host` varchar(32) NOT NULL, + `domain` varchar(256) NOT NULL, + `forwarding_address` varchar(128), + `postal_id` varchar(64), + `domain_status` enum('unverified','pending','active','disabled') NOT NULL DEFAULT 'unverified', + `sending_mode` enum('native','external','disabled') NOT NULL, + `receiving_mode` enum('native','forwarding','disabled') NOT NULL, + `dkim_key` varchar(32), + `dkim_value` varchar(256), + `verification_token` varchar(64), + `mx_dns_valid` boolean NOT NULL DEFAULT false, + `dkim_dns_valid` boolean NOT NULL DEFAULT false, + `spf_dns_valid` boolean NOT NULL DEFAULT false, + `return_path_dns_valid` boolean NOT NULL DEFAULT false, + `last_dns_check_at` timestamp, + `disabled_at` timestamp, + `verified_at` timestamp, + `created_at` timestamp NOT NULL, + CONSTRAINT `domains_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `domain_org_idx` UNIQUE(`domain`,`org_id`), + CONSTRAINT `postal_id_idx` UNIQUE(`postal_id`) +); +--> statement-breakpoint +CREATE TABLE `email_identities` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `username` varchar(32) NOT NULL, + `domain_name` varchar(128) NOT NULL, + `domain_id` bigint unsigned, + `routing_rule_id` bigint unsigned NOT NULL, + `send_name` varchar(128), + `created_by` bigint unsigned NOT NULL, + `is_catch_all` boolean NOT NULL DEFAULT false, + `personal_email_identity_id` bigint unsigned, + `external_credentials_id` bigint unsigned, + `forwarding_address` varchar(128), + `created_at` timestamp NOT NULL, + CONSTRAINT `email_identities_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `email_idx` UNIQUE(`username`,`domain_name`) +); +--> statement-breakpoint +CREATE TABLE `email_identities_authorized_org_members` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `identity_id` bigint unsigned NOT NULL, + `org_member_id` bigint unsigned, + `team_id` bigint unsigned, + `space_id` bigint unsigned, + `added_by` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `email_identities_authorized_org_members_id` PRIMARY KEY(`id`), + CONSTRAINT `org_member_to_identity_idx` UNIQUE(`identity_id`,`org_member_id`), + CONSTRAINT `team_to_identity_idx` UNIQUE(`identity_id`,`team_id`) +); +--> statement-breakpoint +CREATE TABLE `email_identities_personal` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(30) NOT NULL, + `account_id` bigint unsigned NOT NULL, + `email_identity_id` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `email_identities_personal_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `email_identity_external` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(30) NOT NULL, + `nickname` varchar(128) NOT NULL, + `created_by` bigint unsigned NOT NULL, + `username` varchar(128) NOT NULL, + `password` varchar(128) NOT NULL, + `hostname` varchar(128) NOT NULL, + `port` smallint NOT NULL, + `auth_method` enum('plain','login') NOT NULL, + `encryption` enum('ssl','tls','starttls','none') NOT NULL DEFAULT 'none', + `created_at` timestamp NOT NULL, + CONSTRAINT `email_identity_external_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `email_routing_rule_assignees` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `rule_destination_id` bigint unsigned NOT NULL, + `org_member_id` bigint unsigned NOT NULL, + `team_id` bigint unsigned, + `created_at` timestamp NOT NULL, + CONSTRAINT `email_routing_rule_assignees_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `email_routing_rules` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `name` varchar(128) NOT NULL, + `description` text, + `created_by` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `email_routing_rules_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `email_routing_rules_destinations` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(30) NOT NULL, + `rule_id` bigint unsigned NOT NULL, + `team_id` bigint unsigned, + `org_member_id` bigint unsigned, + `space_id` bigint unsigned, + `created_at` timestamp NOT NULL, + CONSTRAINT `email_routing_rules_destinations_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `org_billing` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `stripe_customer_id` varchar(128) NOT NULL, + `stripe_subscription_id` varchar(128), + `plan` enum('starter','pro') NOT NULL DEFAULT 'starter', + `period` enum('monthly','yearly') NOT NULL DEFAULT 'monthly', + CONSTRAINT `org_billing_id` PRIMARY KEY(`id`), + CONSTRAINT `stripe_customer_id_idx` UNIQUE(`stripe_customer_id`), + CONSTRAINT `stripe_subscription_id_idx` UNIQUE(`stripe_subscription_id`) +); +--> statement-breakpoint +CREATE TABLE `org_invitations` ( + `id` serial AUTO_INCREMENT NOT NULL, + `public_id` char(29) NOT NULL, + `org_id` bigint unsigned NOT NULL, + `invited_by_org_member_id` bigint unsigned NOT NULL, + `role` enum('member','admin') NOT NULL, + `org_member_id` bigint unsigned, + `invited_org_member_profile_id` bigint unsigned, + `email` varchar(128), + `invite_token` varchar(64), + `invited_at` timestamp NOT NULL, + `expires_at` timestamp, + `accepted_at` timestamp, + CONSTRAINT `org_invitations_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `org_member_id_idx` UNIQUE(`org_member_id`), + CONSTRAINT `org_email_unique_idx` UNIQUE(`org_id`,`email`) +); +--> statement-breakpoint +CREATE TABLE `org_member_profiles` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(30) NOT NULL, + `avatar_timestamp` timestamp, + `account_id` bigint unsigned, + `first_name` varchar(64), + `last_name` varchar(64), + `handle` varchar(64), + `title` varchar(64), + `blurb` text, + `created_at` timestamp NOT NULL, + CONSTRAINT `org_member_profiles_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `org_members` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `account_id` bigint unsigned, + `invited_by_org_member_id` bigint unsigned, + `status` enum('invited','active','removed') NOT NULL, + `role` enum('member','admin') NOT NULL, + `personal_space_id` bigint unsigned, + `org_member_profile_id` bigint unsigned NOT NULL, + `default_email_identity_id` bigint unsigned, + `added_at` timestamp NOT NULL, + `removed_at` timestamp, + CONSTRAINT `org_members_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `org_account_idx` UNIQUE(`org_id`,`account_id`) +); +--> statement-breakpoint +CREATE TABLE `org_modules` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `module` enum('strip signatures','anonymous analytics') NOT NULL, + `enabled` boolean NOT NULL DEFAULT false, + `last_modified_by_org_member` bigint unsigned NOT NULL, + `last_modified_at` timestamp, + `created_at` timestamp NOT NULL, + CONSTRAINT `org_modules_id` PRIMARY KEY(`id`), + CONSTRAINT `org_module_idx` UNIQUE(`org_id`,`module`) +); +--> statement-breakpoint +CREATE TABLE `org_postal_configs` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `host` varchar(32) NOT NULL, + `ip_pools` json NOT NULL, + `default_ip_pool` varchar(32) NOT NULL, + CONSTRAINT `org_postal_configs_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `orgs` ( + `id` serial AUTO_INCREMENT NOT NULL, + `public_id` char(28) NOT NULL, + `avatar_timestamp` timestamp, + `shortcode` varchar(64) NOT NULL, + `owner_id` bigint unsigned NOT NULL, + `name` varchar(64) NOT NULL, + `metadata` json DEFAULT ('{}'), + `migrated_to_spaces` boolean NOT NULL DEFAULT false, + `created_at` timestamp NOT NULL, + CONSTRAINT `orgs_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `shortcode_idx` UNIQUE(`shortcode`) +); +--> statement-breakpoint +CREATE TABLE `pending_attachments` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `org_public_id` char(28) NOT NULL, + `filename` varchar(256) NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `pending_attachments_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `postal_servers` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `type` enum('email','transactional','marketing') NOT NULL, + `api_key` varchar(64) NOT NULL, + `smtp_key` varchar(64), + `root_forwarding_address` varchar(128), + CONSTRAINT `postal_servers_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `sessions` ( + `id` serial AUTO_INCREMENT NOT NULL, + `public_id` char(29) NOT NULL, + `account_id` bigint unsigned NOT NULL, + `account_public_id` char(28) NOT NULL, + `session_token` varchar(255) NOT NULL, + `device` varchar(255) NOT NULL, + `os` varchar(255) NOT NULL, + `expires_at` timestamp NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `sessions_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `session_token_idx` UNIQUE(`session_token`) +); +--> statement-breakpoint +CREATE TABLE `space_members` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `space_id` bigint unsigned NOT NULL, + `org_member_id` bigint unsigned, + `team_id` bigint unsigned, + `role` enum('member','admin') NOT NULL DEFAULT 'member', + `notifications` enum('active','muted','off') NOT NULL DEFAULT 'active', + `added_by_org_member_id` bigint unsigned NOT NULL, + `added_at` timestamp NOT NULL, + `removed_at` timestamp, + `can_create` boolean NOT NULL DEFAULT true, + `can_read` boolean NOT NULL DEFAULT true, + `can_comment` boolean NOT NULL DEFAULT true, + `can_reply` boolean NOT NULL DEFAULT true, + `can_delete` boolean NOT NULL DEFAULT true, + `can_change_workflow` boolean NOT NULL DEFAULT true, + `can_set_workflow_to_closed` boolean NOT NULL DEFAULT true, + `can_add_tags` boolean NOT NULL DEFAULT true, + `can_move_to_another_space` boolean NOT NULL DEFAULT true, + `can_add_to_another_space` boolean NOT NULL DEFAULT true, + `can_merge` boolean NOT NULL DEFAULT true, + `can_add_participants` boolean NOT NULL DEFAULT true, + CONSTRAINT `space_members_id` PRIMARY KEY(`id`) +); +--> statement-breakpoint +CREATE TABLE `space_tags` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `space_id` bigint unsigned NOT NULL, + `label` varchar(32) NOT NULL, + `description` text, + `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass') NOT NULL, + `icon` varchar(32) NOT NULL DEFAULT 'tag-simple', + `created_by_org_member_id` bigint unsigned NOT NULL, + `disabled` boolean NOT NULL DEFAULT false, + `created_at` timestamp NOT NULL, + CONSTRAINT `space_tags_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `space_workflows` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `space_id` bigint unsigned NOT NULL, + `type` enum('open','active','closed') NOT NULL, + `order` tinyint unsigned NOT NULL, + `name` varchar(32) NOT NULL, + `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass') NOT NULL, + `icon` varchar(32) NOT NULL DEFAULT 'check', + `description` text, + `disabled` boolean NOT NULL DEFAULT false, + `created_by_org_member_id` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `space_workflows_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE TABLE `spaces` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `parent_space_id` bigint unsigned, + `public_id` char(28) NOT NULL, + `shortcode` varchar(64) NOT NULL, + `type` enum('open','private') NOT NULL, + `personal_space` boolean NOT NULL DEFAULT false, + `convo_prefix` varchar(8), + `inherit_parent_permissions` boolean NOT NULL DEFAULT false, + `name` varchar(128) NOT NULL, + `icon` varchar(32) NOT NULL DEFAULT 'squares-four', + `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass') NOT NULL, + `description` text, + `avatar_timestamp` timestamp, + `created_by_org_member_id` bigint unsigned NOT NULL, + `created_at` timestamp NOT NULL, + CONSTRAINT `spaces_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`), + CONSTRAINT `shortcode_org_unique_idx` UNIQUE(`shortcode`,`org_id`) +); +--> statement-breakpoint +CREATE TABLE `team_members` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(29) NOT NULL, + `team_id` bigint unsigned NOT NULL, + `org_member_id` bigint unsigned NOT NULL, + `org_member_profile_id` bigint unsigned, + `added_by` bigint unsigned NOT NULL, + `role` enum('member','admin') NOT NULL DEFAULT 'member', + `notifications` enum('active','muted','off') NOT NULL DEFAULT 'active', + `created_at` timestamp NOT NULL, + CONSTRAINT `team_members_id` PRIMARY KEY(`id`), + CONSTRAINT `org_member_to_team_idx` UNIQUE(`team_id`,`org_member_id`) +); +--> statement-breakpoint +CREATE TABLE `teams` ( + `id` serial AUTO_INCREMENT NOT NULL, + `org_id` bigint unsigned NOT NULL, + `public_id` char(28) NOT NULL, + `avatar_timestamp` timestamp, + `name` varchar(128) NOT NULL, + `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass'), + `description` text, + `default_email_identity_id` bigint unsigned, + `default_space_id` bigint unsigned, + `created_at` timestamp NOT NULL, + CONSTRAINT `teams_id` PRIMARY KEY(`id`), + CONSTRAINT `public_id_idx` UNIQUE(`public_id`) +); +--> statement-breakpoint +CREATE INDEX `account_id_idx` ON `account_credentials` (`account_id`);--> statement-breakpoint +CREATE INDEX `provider_account_id_idx` ON `authenticators` (`account_credential_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `contacts` (`org_id`);--> statement-breakpoint +CREATE INDEX `email_idx` ON `contacts` (`email_username`,`email_domain`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_attachments` (`org_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_attachments` (`convo_id`);--> statement-breakpoint +CREATE INDEX `convo_entry_id_idx` ON `convo_attachments` (`convo_entry_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_entries` (`org_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_entries` (`convo_id`);--> statement-breakpoint +CREATE INDEX `subject_id_idx` ON `convo_entries` (`subject_id`);--> statement-breakpoint +CREATE INDEX `author_idx` ON `convo_entries` (`author`);--> statement-breakpoint +CREATE INDEX `type_idx` ON `convo_entries` (`type`);--> statement-breakpoint +CREATE INDEX `reply_to_id_idx` ON `convo_entries` (`reply_to_id`);--> statement-breakpoint +CREATE INDEX `created_at_idx` ON `convo_entries` (`created_at`);--> statement-breakpoint +CREATE INDEX `email_message_id_idx` ON `convo_entries` (`email_message_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_entry_private_visibility_participants` (`org_id`);--> statement-breakpoint +CREATE INDEX `entry_id_idx` ON `convo_entry_private_visibility_participants` (`entry_id`);--> statement-breakpoint +CREATE INDEX `convo_member_id_idx` ON `convo_entry_private_visibility_participants` (`convo_member_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_entry_raw_html_emails` (`org_id`);--> statement-breakpoint +CREATE INDEX `entry_id_idx` ON `convo_entry_raw_html_emails` (`entry_id`);--> statement-breakpoint +CREATE INDEX `wipe_date_idx` ON `convo_entry_raw_html_emails` (`wipe_date`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_entry_replies` (`org_id`);--> statement-breakpoint +CREATE INDEX `entry_source_id_idx` ON `convo_entry_replies` (`convo_message_source_id`);--> statement-breakpoint +CREATE INDEX `entry_reply_id_idx` ON `convo_entry_replies` (`convo_message_reply_id`);--> statement-breakpoint +CREATE INDEX `created_at_idx` ON `convo_entry_replies` (`created_at`);--> statement-breakpoint +CREATE INDEX `convo_entry_id_idx` ON `convo_entry_seen_timestamps` (`convo_entry_id`);--> statement-breakpoint +CREATE INDEX `participant_id_idx` ON `convo_entry_seen_timestamps` (`participant_id`);--> statement-breakpoint +CREATE INDEX `seen_at_idx` ON `convo_entry_seen_timestamps` (`seen_at`);--> statement-breakpoint +CREATE INDEX `convo_participant_id_idx` ON `convo_participant_team_members` (`convo_participant_id`);--> statement-breakpoint +CREATE INDEX `team_id_idx` ON `convo_participant_team_members` (`team_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_participants` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_member_id_idx` ON `convo_participants` (`org_member_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_participants` (`convo_id`);--> statement-breakpoint +CREATE INDEX `org_member_to_convo_idx` ON `convo_participants` (`convo_id`,`org_member_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_seen_timestamps` (`convo_id`);--> statement-breakpoint +CREATE INDEX `seen_at_idx` ON `convo_seen_timestamps` (`seen_at`);--> statement-breakpoint +CREATE INDEX `participant_id_idx` ON `convo_seen_timestamps` (`participant_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_subjects` (`org_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_subjects` (`convo_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_tags` (`org_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_tags` (`convo_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `convo_tags` (`space_id`);--> statement-breakpoint +CREATE INDEX `convo_to_spaces_id_idx` ON `convo_tags` (`convo_to_space_id`);--> statement-breakpoint +CREATE INDEX `tag_idx` ON `convo_tags` (`tag_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_to_spaces` (`org_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_to_spaces` (`convo_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `convo_to_spaces` (`space_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convo_workflows` (`org_id`);--> statement-breakpoint +CREATE INDEX `convo_id_idx` ON `convo_workflows` (`convo_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `convo_workflows` (`space_id`);--> statement-breakpoint +CREATE INDEX `convo_to_spaces_id_idx` ON `convo_workflows` (`convo_to_space_id`);--> statement-breakpoint +CREATE INDEX `workflow_idx` ON `convo_workflows` (`workflow_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `convos` (`org_id`);--> statement-breakpoint +CREATE INDEX `created_at_idx` ON `convos` (`created_at`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `domains` (`org_id`);--> statement-breakpoint +CREATE INDEX `domain_name_idx` ON `domains` (`domain`);--> statement-breakpoint +CREATE INDEX `domain_id_idx` ON `email_identities` (`domain_name`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_identities` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_identities_authorized_org_members` (`org_id`);--> statement-breakpoint +CREATE INDEX `identity_id_idx` ON `email_identities_authorized_org_members` (`identity_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `email_identities_authorized_org_members` (`space_id`);--> statement-breakpoint +CREATE INDEX `account_id_idx` ON `email_identities_personal` (`account_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_identities_personal` (`org_id`);--> statement-breakpoint +CREATE INDEX `email_identity_id_idx` ON `email_identities_personal` (`email_identity_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_identity_external` (`org_id`);--> statement-breakpoint +CREATE INDEX `rule_destination_id_idx` ON `email_routing_rule_assignees` (`rule_destination_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_routing_rule_assignees` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_member_id_idx` ON `email_routing_rule_assignees` (`org_member_id`);--> statement-breakpoint +CREATE INDEX `team_id_idx` ON `email_routing_rule_assignees` (`team_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_routing_rules` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `email_routing_rules_destinations` (`org_id`);--> statement-breakpoint +CREATE INDEX `rule_id_idx` ON `email_routing_rules_destinations` (`rule_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `email_routing_rules_destinations` (`space_id`);--> statement-breakpoint +CREATE INDEX `team_id_idx` ON `email_routing_rules_destinations` (`team_id`);--> statement-breakpoint +CREATE INDEX `org_member_id_idx` ON `email_routing_rules_destinations` (`org_member_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `org_billing` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `org_invitations` (`org_id`);--> statement-breakpoint +CREATE INDEX `account_id_idx` ON `org_member_profiles` (`account_id`);--> statement-breakpoint +CREATE INDEX `account_id_idx` ON `org_members` (`account_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `org_members` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `org_modules` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `org_postal_configs` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `pending_attachments` (`org_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `postal_servers` (`org_id`);--> statement-breakpoint +CREATE INDEX `account_id_idx` ON `sessions` (`account_id`);--> statement-breakpoint +CREATE INDEX `expires_at_idx` ON `sessions` (`expires_at`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `space_members` (`org_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `space_members` (`space_id`);--> statement-breakpoint +CREATE INDEX `org_member_id_idx` ON `space_members` (`org_member_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `space_tags` (`org_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `space_tags` (`space_id`);--> statement-breakpoint +CREATE INDEX `created_by_org_member_id_idx` ON `space_tags` (`created_by_org_member_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `space_workflows` (`org_id`);--> statement-breakpoint +CREATE INDEX `space_id_idx` ON `space_workflows` (`space_id`);--> statement-breakpoint +CREATE INDEX `shortcode_idx` ON `spaces` (`shortcode`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `spaces` (`org_id`);--> statement-breakpoint +CREATE INDEX `team_id_idx` ON `team_members` (`team_id`);--> statement-breakpoint +CREATE INDEX `org_member_id_idx` ON `team_members` (`org_member_id`);--> statement-breakpoint +CREATE INDEX `org_id_idx` ON `teams` (`org_id`); \ No newline at end of file diff --git a/packages/database/migrations/0000_talented_wendell_vaughn.sql b/packages/database/migrations/0000_talented_wendell_vaughn.sql deleted file mode 100644 index 056576e6..00000000 --- a/packages/database/migrations/0000_talented_wendell_vaughn.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Migration: 0000_talented_wendell_vaughn - --- Write your SQL migration here - --- Add up migration - --- Add down migration diff --git a/packages/database/migrations/0001_confused_black_knight.sql b/packages/database/migrations/0001_confused_black_knight.sql deleted file mode 100644 index 6a2f58a8..00000000 --- a/packages/database/migrations/0001_confused_black_knight.sql +++ /dev/null @@ -1,239 +0,0 @@ -CREATE TABLE `convo_tags` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `public_id` char(30) NOT NULL, - `convo_id` bigint unsigned NOT NULL, - `space_id` bigint unsigned NOT NULL, - `convo_to_space_id` bigint unsigned NOT NULL, - `tag_id` bigint unsigned NOT NULL, - `added_by_org_member_id` bigint unsigned NOT NULL, - `added_at` timestamp NOT NULL, - CONSTRAINT `convo_tags_id` PRIMARY KEY(`id`), - CONSTRAINT `public_id_idx` UNIQUE(`public_id`) -); ---> statement-breakpoint -CREATE TABLE `convo_to_spaces` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `public_id` char(30) NOT NULL, - `convo_id` bigint unsigned NOT NULL, - `space_id` bigint unsigned NOT NULL, - CONSTRAINT `convo_to_spaces_id` PRIMARY KEY(`id`), - CONSTRAINT `public_id_idx` UNIQUE(`public_id`) -); ---> statement-breakpoint -CREATE TABLE `convo_workflows` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `public_id` char(29) NOT NULL, - `convo_id` bigint unsigned NOT NULL, - `space_id` bigint unsigned NOT NULL, - `convo_to_space_id` bigint unsigned NOT NULL, - `workflow_id` bigint unsigned, - `by_org_member_id` bigint unsigned NOT NULL, - `created_at` timestamp NOT NULL, - CONSTRAINT `convo_workflows_id` PRIMARY KEY(`id`), - CONSTRAINT `public_id_idx` UNIQUE(`public_id`) -); ---> statement-breakpoint -CREATE TABLE `email_routing_rule_assignees` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `rule_destination_id` bigint unsigned NOT NULL, - `org_member_id` bigint unsigned NOT NULL, - `team_id` bigint unsigned, - `created_at` timestamp NOT NULL, - CONSTRAINT `email_routing_rule_assignees_id` PRIMARY KEY(`id`) -); ---> statement-breakpoint -CREATE TABLE `space_members` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `public_id` char(29) NOT NULL, - `space_id` bigint unsigned NOT NULL, - `org_member_id` bigint unsigned, - `team_id` bigint unsigned, - `role` enum('member','admin') NOT NULL DEFAULT 'member', - `notifications` enum('active','muted','off') NOT NULL DEFAULT 'active', - `added_by_org_member_id` bigint unsigned NOT NULL, - `added_at` timestamp NOT NULL, - `removed_at` timestamp, - `can_create` boolean NOT NULL DEFAULT true, - `can_read` boolean NOT NULL DEFAULT true, - `can_comment` boolean NOT NULL DEFAULT true, - `can_reply` boolean NOT NULL DEFAULT true, - `can_delete` boolean NOT NULL DEFAULT true, - `can_change_workflow` boolean NOT NULL DEFAULT true, - `can_set_workflow_to_closed` boolean NOT NULL DEFAULT true, - `can_add_tags` boolean NOT NULL DEFAULT true, - `can_move_to_another_space` boolean NOT NULL DEFAULT true, - `can_add_to_another_space` boolean NOT NULL DEFAULT true, - `can_merge` boolean NOT NULL DEFAULT true, - `can_add_participants` boolean NOT NULL DEFAULT true, - CONSTRAINT `space_members_id` PRIMARY KEY(`id`) -); ---> statement-breakpoint -CREATE TABLE `space_tags` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `public_id` char(29) NOT NULL, - `space_id` bigint unsigned NOT NULL, - `label` varchar(32) NOT NULL, - `description` text, - `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass') NOT NULL, - `icon` varchar(32) NOT NULL DEFAULT 'tag-simple', - `created_by_org_member_id` bigint unsigned NOT NULL, - `disabled` boolean NOT NULL DEFAULT false, - `created_at` timestamp NOT NULL, - CONSTRAINT `space_tags_id` PRIMARY KEY(`id`), - CONSTRAINT `public_id_idx` UNIQUE(`public_id`) -); ---> statement-breakpoint -CREATE TABLE `space_workflows` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `public_id` char(29) NOT NULL, - `space_id` bigint unsigned NOT NULL, - `type` enum('open','active','closed') NOT NULL, - `order` tinyint unsigned NOT NULL, - `name` varchar(32) NOT NULL, - `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass') NOT NULL, - `icon` varchar(32) NOT NULL DEFAULT 'check', - `description` text, - `disabled` boolean NOT NULL DEFAULT false, - `created_by_org_member_id` bigint unsigned NOT NULL, - `created_at` timestamp NOT NULL, - CONSTRAINT `space_workflows_id` PRIMARY KEY(`id`), - CONSTRAINT `public_id_idx` UNIQUE(`public_id`) -); ---> statement-breakpoint -CREATE TABLE `spaces` ( - `id` serial AUTO_INCREMENT NOT NULL, - `org_id` bigint unsigned NOT NULL, - `parent_space_id` bigint unsigned, - `public_id` char(28) NOT NULL, - `shortcode` varchar(64) NOT NULL, - `type` enum('open','private') NOT NULL, - `personal_space` boolean NOT NULL DEFAULT false, - `convo_prefix` varchar(8), - `inherit_parent_permissions` boolean NOT NULL DEFAULT false, - `name` varchar(128) NOT NULL, - `icon` varchar(32) NOT NULL DEFAULT 'squares-four', - `color` enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass') NOT NULL, - `description` text, - `avatar_timestamp` timestamp, - `created_by_org_member_id` bigint unsigned NOT NULL, - `created_at` timestamp NOT NULL, - CONSTRAINT `spaces_id` PRIMARY KEY(`id`), - CONSTRAINT `public_id_idx` UNIQUE(`public_id`), - CONSTRAINT `shortcode_org_unique_idx` UNIQUE(`shortcode`,`org_id`) -); ---> statement-breakpoint -ALTER TABLE `account_credentials` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `accounts` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `authenticators` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `contact_global_reputations` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `contacts` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_attachments` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_entries` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_entry_private_visibility_participants` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_entry_raw_html_emails` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_entry_replies` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_participant_team_members` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_participants` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convo_subjects` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `convos` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `domains` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `email_identities` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `email_identities_authorized_org_members` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `email_identities_personal` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `email_identity_external` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `email_routing_rules` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `email_routing_rules_destinations` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `org_billing` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `org_invitations` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `org_member_profiles` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `org_members` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `org_modules` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `org_postal_configs` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `orgs` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `pending_attachments` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `postal_servers` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `sessions` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `team_members` DROP INDEX `id`;--> statement-breakpoint -ALTER TABLE `teams` DROP INDEX `id`;--> statement-breakpoint -DROP INDEX `last_updated_at_idx` ON `convos`;--> statement-breakpoint -ALTER TABLE `convo_entry_seen_timestamps` DROP PRIMARY KEY;--> statement-breakpoint -ALTER TABLE `convo_seen_timestamps` DROP PRIMARY KEY;--> statement-breakpoint -ALTER TABLE `account_credentials` MODIFY COLUMN `two_factor_enabled` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `account_credentials` MODIFY COLUMN `two_factor_enabled` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `accounts` MODIFY COLUMN `two_factor_enabled` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `accounts` MODIFY COLUMN `two_factor_enabled` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `accounts` MODIFY COLUMN `pre_account` boolean NOT NULL DEFAULT true;--> statement-breakpoint -ALTER TABLE `authenticators` MODIFY COLUMN `credential_backed_up` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `authenticators` MODIFY COLUMN `account_id` bigint unsigned NOT NULL;--> statement-breakpoint -ALTER TABLE `convo_attachments` MODIFY COLUMN `public` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `convo_attachments` MODIFY COLUMN `public` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `convo_attachments` MODIFY COLUMN `inline` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `convo_attachments` MODIFY COLUMN `inline` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `convo_entries` MODIFY COLUMN `email_message_id` varchar(255);--> statement-breakpoint -ALTER TABLE `convo_entry_raw_html_emails` MODIFY COLUMN `keep` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `convo_entry_raw_html_emails` MODIFY COLUMN `keep` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `convo_entry_raw_html_emails` MODIFY COLUMN `wiped` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `convo_entry_raw_html_emails` MODIFY COLUMN `wiped` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `convo_participants` MODIFY COLUMN `role` enum('assigned','contributor','commenter','watcher','teamMember','guest') NOT NULL DEFAULT 'contributor';--> statement-breakpoint -ALTER TABLE `convo_participants` MODIFY COLUMN `active` boolean NOT NULL DEFAULT true;--> statement-breakpoint -ALTER TABLE `convo_participants` MODIFY COLUMN `hidden` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `convo_participants` MODIFY COLUMN `hidden` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `mx_dns_valid` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `mx_dns_valid` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `dkim_dns_valid` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `dkim_dns_valid` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `spf_dns_valid` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `spf_dns_valid` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `return_path_dns_valid` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `return_path_dns_valid` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `disabled` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `domains` MODIFY COLUMN `disabled` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `email_identities` MODIFY COLUMN `is_catch_all` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `email_identities` MODIFY COLUMN `is_catch_all` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `org_modules` MODIFY COLUMN `enabled` boolean NOT NULL;--> statement-breakpoint -ALTER TABLE `org_modules` MODIFY COLUMN `enabled` boolean NOT NULL DEFAULT false;--> statement-breakpoint -ALTER TABLE `convo_entry_seen_timestamps` ADD PRIMARY KEY(`convo_entry_id`,`participant_id`,`org_member_id`);--> statement-breakpoint -ALTER TABLE `convo_seen_timestamps` ADD PRIMARY KEY(`convo_id`,`participant_id`,`org_member_id`);--> statement-breakpoint -ALTER TABLE `email_identities_authorized_org_members` ADD `space_id` bigint unsigned;--> statement-breakpoint -ALTER TABLE `email_routing_rules_destinations` ADD `space_id` bigint unsigned;--> statement-breakpoint -ALTER TABLE `org_members` ADD `personal_space_id` bigint unsigned;--> statement-breakpoint -ALTER TABLE `org_members` ADD `default_email_identity_id` bigint unsigned;--> statement-breakpoint -ALTER TABLE `teams` ADD `default_email_identity_id` bigint unsigned;--> statement-breakpoint -ALTER TABLE `teams` ADD `default_space_id` bigint unsigned;--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `convo_tags` (`org_id`);--> statement-breakpoint -CREATE INDEX `convo_id_idx` ON `convo_tags` (`convo_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `convo_tags` (`space_id`);--> statement-breakpoint -CREATE INDEX `convo_to_spaces_id_idx` ON `convo_tags` (`convo_to_space_id`);--> statement-breakpoint -CREATE INDEX `tag_idx` ON `convo_tags` (`tag_id`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `convo_to_spaces` (`org_id`);--> statement-breakpoint -CREATE INDEX `convo_id_idx` ON `convo_to_spaces` (`convo_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `convo_to_spaces` (`space_id`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `convo_workflows` (`org_id`);--> statement-breakpoint -CREATE INDEX `convo_id_idx` ON `convo_workflows` (`convo_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `convo_workflows` (`space_id`);--> statement-breakpoint -CREATE INDEX `convo_to_spaces_id_idx` ON `convo_workflows` (`convo_to_space_id`);--> statement-breakpoint -CREATE INDEX `workflow_idx` ON `convo_workflows` (`workflow_id`);--> statement-breakpoint -CREATE INDEX `rule_destination_id_idx` ON `email_routing_rule_assignees` (`rule_destination_id`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `email_routing_rule_assignees` (`org_id`);--> statement-breakpoint -CREATE INDEX `org_member_id_idx` ON `email_routing_rule_assignees` (`org_member_id`);--> statement-breakpoint -CREATE INDEX `team_id_idx` ON `email_routing_rule_assignees` (`team_id`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `space_members` (`org_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `space_members` (`space_id`);--> statement-breakpoint -CREATE INDEX `org_member_id_idx` ON `space_members` (`org_member_id`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `space_tags` (`org_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `space_tags` (`space_id`);--> statement-breakpoint -CREATE INDEX `created_by_org_member_id_idx` ON `space_tags` (`created_by_org_member_id`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `space_workflows` (`org_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `space_workflows` (`space_id`);--> statement-breakpoint -CREATE INDEX `shortcode_idx` ON `spaces` (`shortcode`);--> statement-breakpoint -CREATE INDEX `org_id_idx` ON `spaces` (`org_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `email_identities_authorized_org_members` (`space_id`);--> statement-breakpoint -CREATE INDEX `space_id_idx` ON `email_routing_rules_destinations` (`space_id`);--> statement-breakpoint -ALTER TABLE `email_identities_authorized_org_members` DROP COLUMN `default`; \ No newline at end of file diff --git a/packages/database/migrations/0002_condemned_cyclops.sql b/packages/database/migrations/0002_condemned_cyclops.sql deleted file mode 100644 index 8935a779..00000000 --- a/packages/database/migrations/0002_condemned_cyclops.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `orgs` ADD `migrated_to_spaces` boolean DEFAULT false NOT NULL; \ No newline at end of file diff --git a/packages/database/migrations/meta/0000_snapshot.json b/packages/database/migrations/meta/0000_snapshot.json index 7594ccfd..96abcb30 100644 --- a/packages/database/migrations/meta/0000_snapshot.json +++ b/packages/database/migrations/meta/0000_snapshot.json @@ -1,62 +1,54 @@ { - "id": "00000000-0000-0000-0000-000000000000", - "prevId": "", "version": "5", "dialect": "mysql", + "id": "f101f2f5-343a-4e48-b975-7b937ee164f5", + "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "account_credentials": { "name": "account_credentials", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "account_id": { - "autoincrement": false, "name": "account_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "password_hash": { - "autoincrement": false, "name": "password_hash", "type": "varchar(255)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "two_factor_secret": { - "autoincrement": false, "name": "two_factor_secret", "type": "varchar(255)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "two_factor_enabled": { - "default": 0, - "autoincrement": false, "name": "two_factor_enabled", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "recovery_code": { - "autoincrement": false, "name": "recovery_code", "type": "varchar(256)", "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "account_credentials_id": { - "name": "account_credentials_id", - "columns": [ - "id" - ] + "notNull": false, + "autoincrement": false } }, "indexes": { @@ -69,479 +61,465 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "account_credentials_id": { + "name": "account_credentials_id", "columns": [ "id" ] } - } + }, + "uniqueConstraints": {} }, "accounts": { "name": "accounts", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "username": { - "autoincrement": false, "name": "username", "type": "varchar(32)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "metadata": { - "autoincrement": false, "name": "metadata", "type": "json", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "last_login_at": { - "autoincrement": false, "name": "last_login_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "password_hash": { - "autoincrement": false, "name": "password_hash", "type": "varchar(255)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false + }, + "recovery_email_hash": { + "name": "recovery_email_hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "recovery_email_verified_at": { + "name": "recovery_email_verified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false }, "two_factor_secret": { - "autoincrement": false, "name": "two_factor_secret", "type": "varchar(255)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "two_factor_enabled": { - "default": 0, - "autoincrement": false, "name": "two_factor_enabled", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "recovery_code": { - "autoincrement": false, "name": "recovery_code", "type": "varchar(256)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "pre_account": { - "default": 1, - "autoincrement": false, "name": "pre_account", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true - }, - "recovery_email_hash": { - "autoincrement": false, - "name": "recovery_email_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "recovery_email_verified_at": { + "notNull": true, "autoincrement": false, - "name": "recovery_email_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "accounts_id": { - "name": "accounts_id", - "columns": [ - "id" - ] + "default": true } }, - "indexes": {}, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] - }, + "indexes": { "public_id_idx": { "name": "public_id_idx", "columns": [ "public_id" - ] + ], + "isUnique": true }, "username_idx": { "name": "username_idx", "columns": [ "username" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "accounts_id": { + "name": "accounts_id", + "columns": [ + "id" ] } - } + }, + "uniqueConstraints": {} }, "authenticators": { "name": "authenticators", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "account_credential_id": { - "autoincrement": false, "name": "account_credential_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false + }, + "account_id": { + "name": "account_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "nickname": { - "autoincrement": false, "name": "nickname", "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "credential_id": { - "autoincrement": false, "name": "credential_id", "type": "varchar(255)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "credential_public_key": { - "autoincrement": false, "name": "credential_public_key", "type": "text", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "counter": { - "autoincrement": false, "name": "counter", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "credential_device_type": { - "autoincrement": false, "name": "credential_device_type", "type": "varchar(32)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "credential_backed_up": { - "autoincrement": false, "name": "credential_backed_up", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "transports": { - "autoincrement": false, "name": "transports", "type": "json", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - }, - "account_id": { - "autoincrement": false, - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "authenticators_id": { - "name": "authenticators_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "provider_account_id_idx": { "name": "provider_account_id_idx", "columns": [ "account_credential_id" ], "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] }, "credential_id_idx": { "name": "credential_id_idx", "columns": [ "credential_id" - ] - }, - "public_id_idx": { - "name": "public_id_idx", + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "authenticators_id": { + "name": "authenticators_id", "columns": [ - "public_id" + "id" ] } - } + }, + "uniqueConstraints": {} }, "contact_global_reputations": { "name": "contact_global_reputations", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "email_address": { - "autoincrement": false, "name": "email_address", "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "spam": { - "default": 0, - "autoincrement": false, "name": "spam", "type": "tinyint", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": 0 }, "cold": { - "default": 0, - "autoincrement": false, "name": "cold", "type": "tinyint", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": 0 }, "newsletter": { - "default": 0, - "autoincrement": false, "name": "newsletter", "type": "tinyint", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": 0 }, "marketing": { - "default": 0, - "autoincrement": false, "name": "marketing", "type": "tinyint", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": 0 }, "product": { - "default": 0, - "autoincrement": false, "name": "product", "type": "tinyint", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": 0 }, "message_count": { - "default": 0, - "autoincrement": false, "name": "message_count", "type": "mediumint", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": 0 }, "last_updated": { - "autoincrement": false, "name": "last_updated", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false } }, - "compositePrimaryKeys": { - "contact_global_reputations_id": { - "name": "contact_global_reputations_id", + "indexes": { + "email_address_idx": { + "name": "email_address_idx", "columns": [ - "id" - ] + "email_address" + ], + "isUnique": true } }, - "indexes": {}, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "contact_global_reputations_id": { + "name": "contact_global_reputations_id", "columns": [ "id" ] - }, - "email_address_idx": { - "name": "email_address_idx", - "columns": [ - "email_address" - ] } - } + }, + "uniqueConstraints": {} }, "contacts": { "name": "contacts", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "avatar_timestamp": { - "autoincrement": false, "name": "avatar_timestamp", "type": "timestamp", "primaryKey": false, - "notNull": false - }, - "org_id": { - "autoincrement": false, - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, "reputation_id": { - "autoincrement": false, "name": "reputation_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "name": { - "autoincrement": false, "name": "name", "type": "varchar(128)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "set_name": { - "autoincrement": false, "name": "set_name", "type": "varchar(128)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "email_username": { - "autoincrement": false, "name": "email_username", "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "email_domain": { - "autoincrement": false, "name": "email_domain", "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "signature": { - "autoincrement": false, "name": "signature", "type": "text", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "signature_html": { - "autoincrement": false, "name": "signature_html", "type": "text", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "type": { - "autoincrement": false, "name": "type", "type": "enum('person','product','newsletter','marketing','unknown')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "screener_status": { - "autoincrement": false, "name": "screener_status", "type": "enum('pending','approve','reject')", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "contacts_id": { - "name": "contacts_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ @@ -556,21 +534,6 @@ "email_domain" ], "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] }, "email_org_unique_idx": { "name": "email_org_unique_idx", @@ -578,106 +541,109 @@ "email_username", "email_domain", "org_id" - ] + ], + "isUnique": true } - } - }, - "convo_attachments": { - "name": "convo_attachments", - "columns": { + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "contacts_id": { + "name": "contacts_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "convo_attachments": { + "name": "convo_attachments", + "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_id": { - "autoincrement": false, "name": "convo_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_entry_id": { - "autoincrement": false, "name": "convo_entry_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "fileName": { - "autoincrement": false, "name": "fileName", "type": "varchar(256)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "type": { - "autoincrement": false, "name": "type", "type": "varchar(256)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "size": { - "autoincrement": false, "name": "size", "type": "int unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "public": { - "default": 0, + "inline": { + "name": "inline", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, + "default": false + }, + "public": { "name": "public", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "convo_participant_id": { - "autoincrement": false, "name": "convo_participant_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - }, - "inline": { - "default": 0, - "autoincrement": false, - "name": "inline", - "type": "tinyint", - "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_attachments_id": { - "name": "convo_attachments_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -701,144 +667,138 @@ "convo_entry_id" ], "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] }, "public_id_idx": { "name": "public_id_idx", "columns": [ "public_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "convo_attachments_id": { + "name": "convo_attachments_id", + "columns": [ + "id" ] } - } + }, + "uniqueConstraints": {} }, "convo_entries": { "name": "convo_entries", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "type": { - "autoincrement": false, "name": "type", "type": "enum('message','comment','draft')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_id": { - "autoincrement": false, "name": "convo_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "subject_id": { - "autoincrement": false, "name": "subject_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "author": { - "autoincrement": false, "name": "author", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "reply_to_id": { - "autoincrement": false, "name": "reply_to_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "body": { - "autoincrement": false, "name": "body", "type": "json", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "body_plain_text": { - "autoincrement": false, "name": "body_plain_text", "type": "longtext", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false + }, + "body_cleaned_html": { + "name": "body_cleaned_html", + "type": "longtext", + "primaryKey": false, + "notNull": false, + "autoincrement": false }, "metadata": { - "default": "('{}')", - "autoincrement": false, "name": "metadata", "type": "json", "primaryKey": false, - "notNull": false - }, - "visibility": { - "autoincrement": false, - "name": "visibility", - "type": "enum('private','internal_participants','org','all_participants')", - "primaryKey": false, - "notNull": true - }, - "created_at": { + "notNull": false, "autoincrement": false, - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true + "default": "('{}')" }, "email_message_id": { - "autoincrement": false, "name": "email_message_id", "type": "varchar(255)", "primaryKey": false, "notNull": false, + "autoincrement": false, "generated": { - "as": "json_unquote(json_extract(`metadata`,_utf8mb4\\'$.email.messageId\\'))", + "as": "JSON_UNQUOTE(metadata-> '$.email.messageId')", "type": "stored" } }, - "body_cleaned_html": { - "autoincrement": false, - "name": "body_cleaned_html", - "type": "longtext", + "visibility": { + "name": "visibility", + "type": "enum('private','internal_participants','org','all_participants')", "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "convo_entries_id": { - "name": "convo_entries_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -856,31 +816,38 @@ ], "isUnique": false }, - "type_idx": { - "name": "type_idx", + "subject_id_idx": { + "name": "subject_id_idx", "columns": [ - "type" + "subject_id" ], "isUnique": false }, - "reply_to_id_idx": { - "name": "reply_to_id_idx", + "author_idx": { + "name": "author_idx", "columns": [ - "reply_to_id" + "author" ], "isUnique": false }, - "subject_id_idx": { - "name": "subject_id_idx", + "public_id_idx": { + "name": "public_id_idx", "columns": [ - "subject_id" + "public_id" + ], + "isUnique": true + }, + "type_idx": { + "name": "type_idx", + "columns": [ + "type" ], "isUnique": false }, - "author_idx": { - "name": "author_idx", + "reply_to_id_idx": { + "name": "reply_to_id_idx", "columns": [ - "author" + "reply_to_id" ], "isUnique": false }, @@ -900,80 +867,67 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_entries_id": { + "name": "convo_entries_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, "convo_entry_private_visibility_participants": { "name": "convo_entry_private_visibility_participants", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "entry_id": { - "autoincrement": false, "name": "entry_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_member_id": { - "autoincrement": false, "name": "convo_member_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_entry_private_visibility_participants_id": { - "name": "convo_entry_private_visibility_participants_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { - "entry_id_idx": { - "name": "entry_id_idx", + "org_id_idx": { + "name": "org_id_idx", "columns": [ - "entry_id" + "org_id" ], "isUnique": false }, - "org_id_idx": { - "name": "org_id_idx", + "entry_id_idx": { + "name": "entry_id_idx", "columns": [ - "org_id" + "entry_id" ], "isUnique": false }, @@ -986,97 +940,90 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_entry_private_visibility_participants_id": { + "name": "convo_entry_private_visibility_participants_id", "columns": [ "id" ] } - } + }, + "uniqueConstraints": {} }, "convo_entry_raw_html_emails": { "name": "convo_entry_raw_html_emails", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "entry_id": { - "autoincrement": false, "name": "entry_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "headers": { - "autoincrement": false, "name": "headers", "type": "json", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "html": { - "autoincrement": false, "name": "html", "type": "mediumtext", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "wipe_date": { - "autoincrement": false, "name": "wipe_date", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "keep": { - "default": 0, - "autoincrement": false, "name": "keep", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "wiped": { - "default": 0, - "autoincrement": false, "name": "wiped", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_entry_raw_html_emails_id": { - "name": "convo_entry_raw_html_emails_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false, + "default": false } }, "indexes": { - "entry_id_idx": { - "name": "entry_id_idx", + "org_id_idx": { + "name": "org_id_idx", "columns": [ - "entry_id" + "org_id" ], "isUnique": false }, - "org_id_idx": { - "name": "org_id_idx", + "entry_id_idx": { + "name": "entry_id_idx", "columns": [ - "org_id" + "entry_id" ], "isUnique": false }, @@ -1089,60 +1036,53 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_entry_raw_html_emails_id": { + "name": "convo_entry_raw_html_emails_id", "columns": [ "id" ] } - } + }, + "uniqueConstraints": {} }, "convo_entry_replies": { "name": "convo_entry_replies", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_message_source_id": { - "autoincrement": false, "name": "convo_message_source_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_message_reply_id": { - "autoincrement": false, "name": "convo_message_reply_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_entry_replies_id": { - "name": "convo_entry_replies_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1176,62 +1116,53 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_entry_replies_id": { + "name": "convo_entry_replies_id", "columns": [ "id" ] } - } + }, + "uniqueConstraints": {} }, "convo_entry_seen_timestamps": { "name": "convo_entry_seen_timestamps", "columns": { "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_entry_id": { - "autoincrement": false, "name": "convo_entry_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "participant_id": { - "autoincrement": false, "name": "participant_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "org_member_id": { - "autoincrement": false, "name": "org_member_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "seen_at": { - "autoincrement": false, "name": "seen_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_entry_seen_timestamps_convo_entry_id_participant_id_org_member_id": { - "name": "convo_entry_seen_timestamps_convo_entry_id_participant_id_org_member_id", - "columns": [ - "convo_entry_id", - "participant_id", - "org_member_id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1242,62 +1173,64 @@ ], "isUnique": false }, - "seen_at_idx": { - "name": "seen_at_idx", + "participant_id_idx": { + "name": "participant_id_idx", "columns": [ - "seen_at" + "participant_id" ], "isUnique": false }, - "participant_id_idx": { - "name": "participant_id_idx", + "seen_at_idx": { + "name": "seen_at_idx", "columns": [ - "participant_id" + "seen_at" ], "isUnique": false } }, "foreignKeys": {}, + "compositePrimaryKeys": { + "id": { + "name": "id", + "columns": [ + "convo_entry_id", + "participant_id", + "org_member_id" + ] + } + }, "uniqueConstraints": {} }, "convo_participant_team_members": { "name": "convo_participant_team_members", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_participant_id": { - "autoincrement": false, "name": "convo_participant_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "team_id": { - "autoincrement": false, "name": "team_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_participant_team_members_id": { - "name": "convo_participant_team_members_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1317,127 +1250,120 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_participant_team_members_id": { + "name": "convo_participant_team_members_id", "columns": [ "id" ] } - } + }, + "uniqueConstraints": {} }, "convo_participants": { "name": "convo_participants", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "org_member_id": { - "autoincrement": false, "name": "org_member_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "team_id": { - "autoincrement": false, "name": "team_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "contact_id": { - "autoincrement": false, "name": "contact_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "convo_id": { - "autoincrement": false, "name": "convo_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "role": { - "default": "'contributor'", - "autoincrement": false, "name": "role", "type": "enum('assigned','contributor','commenter','watcher','teamMember','guest')", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false, + "default": "'contributor'" }, "email_identity_id": { - "autoincrement": false, "name": "email_identity_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "notifications": { - "default": "'active'", - "autoincrement": false, "name": "notifications", "type": "enum('active','muted','off')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": "'active'" }, "last_read_at": { - "autoincrement": false, "name": "last_read_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "active": { - "default": 1, - "autoincrement": false, "name": "active", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true - }, - "created_at": { + "notNull": true, "autoincrement": false, - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true + "default": true }, "hidden": { - "default": 0, - "autoincrement": false, "name": "hidden", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_participants_id": { - "name": "convo_participants_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1448,6 +1374,13 @@ ], "isUnique": false }, + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_member_id_idx": { "name": "org_member_id_idx", "columns": [ @@ -1461,85 +1394,72 @@ "convo_id" ], "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] }, "org_member_to_convo_idx": { "name": "org_member_to_convo_idx", "columns": [ "convo_id", "org_member_id" - ] + ], + "isUnique": false }, "team_to_convo_idx": { "name": "team_to_convo_idx", "columns": [ "convo_id", "team_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "convo_participants_id": { + "name": "convo_participants_id", + "columns": [ + "id" ] } - } + }, + "uniqueConstraints": {} }, "convo_seen_timestamps": { "name": "convo_seen_timestamps", "columns": { "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_id": { - "autoincrement": false, "name": "convo_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "participant_id": { - "autoincrement": false, "name": "participant_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "org_member_id": { - "autoincrement": false, "name": "org_member_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "seen_at": { - "autoincrement": false, "name": "seen_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_seen_timestamps_convo_id_participant_id_org_member_id": { - "name": "convo_seen_timestamps_convo_id_participant_id_org_member_id", - "columns": [ - "convo_id", - "participant_id", - "org_member_id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1566,60 +1486,62 @@ } }, "foreignKeys": {}, + "compositePrimaryKeys": { + "id": { + "name": "id", + "columns": [ + "convo_id", + "participant_id", + "org_member_id" + ] + } + }, "uniqueConstraints": {} }, "convo_subjects": { "name": "convo_subjects", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "convo_id": { - "autoincrement": false, "name": "convo_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "subject": { - "autoincrement": false, "name": "subject", "type": "varchar(256)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convo_subjects_id": { - "name": "convo_subjects_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1630,6 +1552,13 @@ ], "isUnique": false }, + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "convo_id_idx": { "name": "convo_id_idx", "columns": [ @@ -1639,66 +1568,81 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_subjects_id": { + "name": "convo_subjects_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "convos": { - "name": "convos", + "convo_tags": { + "name": "convo_tags", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", - "type": "char(28)", + "type": "char(30)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "last_updated_at": { - "autoincrement": false, - "name": "last_updated_at", - "type": "timestamp", + "convo_id": { + "name": "convo_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "created_at": { - "autoincrement": false, - "name": "created_at", + "space_id": { + "name": "space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "convo_to_space_id": { + "name": "convo_to_space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tag_id": { + "name": "tag_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_by_org_member_id": { + "name": "added_by_org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_at": { + "name": "added_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "convos_id": { - "name": "convos_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -1709,217 +1653,507 @@ ], "isUnique": false }, - "last_updated_at_idx": { - "name": "last_updated_at_idx", + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "convo_id_idx": { + "name": "convo_id_idx", "columns": [ - "last_updated_at" + "convo_id" ], "isUnique": false }, - "created_at_idx": { - "name": "created_at_idx", + "space_id_idx": { + "name": "space_id_idx", "columns": [ - "created_at" + "space_id" + ], + "isUnique": false + }, + "convo_to_spaces_id_idx": { + "name": "convo_to_spaces_id_idx", + "columns": [ + "convo_to_space_id" + ], + "isUnique": false + }, + "tag_idx": { + "name": "tag_idx", + "columns": [ + "tag_id" ], "isUnique": false } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "convo_tags_id": { + "name": "convo_tags_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "domains": { - "name": "domains", + "convo_to_spaces": { + "name": "convo_to_spaces", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true - }, - "public_id": { - "autoincrement": false, - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "catch_all_address": { - "autoincrement": false, + "public_id": { + "name": "public_id", + "type": "char(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "convo_id": { + "name": "convo_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "convo_id_idx": { + "name": "convo_id_idx", + "columns": [ + "convo_id" + ], + "isUnique": false + }, + "space_id_idx": { + "name": "space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "convo_to_spaces_id": { + "name": "convo_to_spaces_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "convo_workflows": { + "name": "convo_workflows", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "public_id": { + "name": "public_id", + "type": "char(29)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "convo_id": { + "name": "convo_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "convo_to_space_id": { + "name": "convo_to_space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "by_org_member_id": { + "name": "by_org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "convo_id_idx": { + "name": "convo_id_idx", + "columns": [ + "convo_id" + ], + "isUnique": false + }, + "space_id_idx": { + "name": "space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "convo_to_spaces_id_idx": { + "name": "convo_to_spaces_id_idx", + "columns": [ + "convo_to_space_id" + ], + "isUnique": false + }, + "workflow_idx": { + "name": "workflow_idx", + "columns": [ + "workflow_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "convo_workflows_id": { + "name": "convo_workflows_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "convos": { + "name": "convos", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "public_id": { + "name": "public_id", + "type": "char(28)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "created_at_idx": { + "name": "created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "convos_id": { + "name": "convos_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "domains": { + "name": "domains", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "disabled": { + "name": "disabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "public_id": { + "name": "public_id", + "type": "char(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "catch_all_address": { "name": "catch_all_address", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "postal_host": { - "autoincrement": false, "name": "postal_host", "type": "varchar(32)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "domain": { - "autoincrement": false, "name": "domain", "type": "varchar(256)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "forwarding_address": { - "autoincrement": false, "name": "forwarding_address", "type": "varchar(128)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "postal_id": { - "autoincrement": false, "name": "postal_id", "type": "varchar(64)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "domain_status": { - "default": "'unverified'", - "autoincrement": false, "name": "domain_status", "type": "enum('unverified','pending','active','disabled')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": "'unverified'" }, "sending_mode": { - "autoincrement": false, "name": "sending_mode", "type": "enum('native','external','disabled')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "receiving_mode": { - "autoincrement": false, "name": "receiving_mode", "type": "enum('native','forwarding','disabled')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "dkim_key": { - "autoincrement": false, "name": "dkim_key", "type": "varchar(32)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "dkim_value": { - "autoincrement": false, "name": "dkim_value", "type": "varchar(256)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "verification_token": { - "autoincrement": false, "name": "verification_token", "type": "varchar(64)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "mx_dns_valid": { - "default": 0, - "autoincrement": false, "name": "mx_dns_valid", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "dkim_dns_valid": { - "default": 0, - "autoincrement": false, "name": "dkim_dns_valid", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "spf_dns_valid": { - "default": 0, - "autoincrement": false, "name": "spf_dns_valid", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "return_path_dns_valid": { - "default": 0, - "autoincrement": false, "name": "return_path_dns_valid", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "last_dns_check_at": { - "autoincrement": false, "name": "last_dns_check_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "disabled_at": { - "autoincrement": false, "name": "disabled_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "verified_at": { - "autoincrement": false, "name": "verified_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - }, - "disabled": { - "default": 0, - "autoincrement": false, - "name": "disabled", - "type": "tinyint", - "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "domains_id": { - "name": "domains_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ @@ -1933,254 +2167,717 @@ "domain" ], "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] }, "domain_org_idx": { "name": "domain_org_idx", "columns": [ "domain", "org_id" - ] + ], + "isUnique": true }, "postal_id_idx": { "name": "postal_id_idx", "columns": [ "postal_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "domains_id": { + "name": "domains_id", + "columns": [ + "id" ] } - } + }, + "uniqueConstraints": {} }, "email_identities": { "name": "email_identities", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true - }, - "public_id": { - "autoincrement": false, - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false + }, + "public_id": { + "name": "public_id", + "type": "char(29)", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "username": { - "autoincrement": false, "name": "username", "type": "varchar(32)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "domain_name": { - "autoincrement": false, "name": "domain_name", "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "domain_id": { - "autoincrement": false, "name": "domain_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "routing_rule_id": { - "autoincrement": false, "name": "routing_rule_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "send_name": { - "autoincrement": false, "name": "send_name", "type": "varchar(128)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "created_by": { - "autoincrement": false, "name": "created_by", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "is_catch_all": { - "default": 0, - "autoincrement": false, "name": "is_catch_all", - "type": "tinyint", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": false }, "personal_email_identity_id": { - "autoincrement": false, "name": "personal_email_identity_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "external_credentials_id": { - "autoincrement": false, "name": "external_credentials_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "forwarding_address": { - "autoincrement": false, "name": "forwarding_address", "type": "varchar(128)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "domain_id_idx": { + "name": "domain_id_idx", + "columns": [ + "domain_name" + ], + "isUnique": false + }, + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "email_idx": { + "name": "email_idx", + "columns": [ + "username", + "domain_name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_identities_id": { + "name": "email_identities_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "email_identities_authorized_org_members": { + "name": "email_identities_authorized_org_members", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "identity_id": { + "name": "identity_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "org_member_id": { + "name": "org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "added_by": { + "name": "added_by", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "identity_id_idx": { + "name": "identity_id_idx", + "columns": [ + "identity_id" + ], + "isUnique": false + }, + "space_id_idx": { + "name": "space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "org_member_to_identity_idx": { + "name": "org_member_to_identity_idx", + "columns": [ + "identity_id", + "org_member_id" + ], + "isUnique": true + }, + "team_to_identity_idx": { + "name": "team_to_identity_idx", + "columns": [ + "identity_id", + "team_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_identities_authorized_org_members_id": { + "name": "email_identities_authorized_org_members_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "email_identities_personal": { + "name": "email_identities_personal", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "public_id": { + "name": "public_id", + "type": "char(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "account_id": { + "name": "account_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email_identity_id": { + "name": "email_identity_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "account_id_idx": { + "name": "account_id_idx", + "columns": [ + "account_id" + ], + "isUnique": false + }, + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "email_identity_id_idx": { + "name": "email_identity_id_idx", + "columns": [ + "email_identity_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_identities_personal_id": { + "name": "email_identities_personal_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "email_identity_external": { + "name": "email_identity_external", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "public_id": { + "name": "public_id", + "type": "char(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nickname": { + "name": "nickname", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "password": { + "name": "password", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "hostname": { + "name": "hostname", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "port": { + "name": "port", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "auth_method": { + "name": "auth_method", + "type": "enum('plain','login')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encryption": { + "name": "encryption", + "type": "enum('ssl','tls','starttls','none')", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_identity_external_id": { + "name": "email_identity_external_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "email_routing_rule_assignees": { + "name": "email_routing_rule_assignees", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rule_destination_id": { + "name": "rule_destination_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "org_member_id": { + "name": "org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "rule_destination_id_idx": { + "name": "rule_destination_id_idx", + "columns": [ + "rule_destination_id" + ], + "isUnique": false + }, + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" + ], + "isUnique": false + }, + "org_member_id_idx": { + "name": "org_member_id_idx", + "columns": [ + "org_member_id" + ], + "isUnique": false + }, + "team_id_idx": { + "name": "team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_routing_rule_assignees_id": { + "name": "email_routing_rule_assignees_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {} + }, + "email_routing_rules": { + "name": "email_routing_rules", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "public_id": { + "name": "public_id", + "type": "char(29)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "email_identities_id": { - "name": "email_identities_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { - "domain_id_idx": { - "name": "domain_id_idx", - "columns": [ - "domain_name" - ], - "isUnique": false - }, "org_id_idx": { "name": "org_id_idx", "columns": [ "org_id" ], "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", - "columns": [ - "id" - ] }, "public_id_idx": { "name": "public_id_idx", "columns": [ "public_id" - ] - }, - "email_idx": { - "name": "email_idx", + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_routing_rules_id": { + "name": "email_routing_rules_id", "columns": [ - "username", - "domain_name" + "id" ] } - } + }, + "uniqueConstraints": {} }, - "email_identities_authorized_org_members": { - "name": "email_identities_authorized_org_members", + "email_routing_rules_destinations": { + "name": "email_routing_rules_destinations", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "identity_id": { - "autoincrement": false, - "name": "identity_id", - "type": "bigint unsigned", + "public_id": { + "name": "public_id", + "type": "char(30)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_member_id": { - "autoincrement": false, - "name": "org_member_id", + "rule_id": { + "name": "rule_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, "team_id": { - "autoincrement": false, "name": "team_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, - "default": { - "default": 0, - "autoincrement": false, - "name": "default", - "type": "tinyint", + "org_member_id": { + "name": "org_member_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "added_by": { - "autoincrement": false, - "name": "added_by", + "space_id": { + "name": "space_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "email_identities_authorized_org_members_id": { - "name": "email_identities_authorized_org_members_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -2191,100 +2888,102 @@ ], "isUnique": false }, - "identity_id_idx": { - "name": "identity_id_idx", + "public_id_idx": { + "name": "public_id_idx", "columns": [ - "identity_id" + "public_id" ], - "isUnique": false - } - }, - "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "isUnique": true + }, + "rule_id_idx": { + "name": "rule_id_idx", "columns": [ - "id" - ] + "rule_id" + ], + "isUnique": false }, - "org_member_to_identity_idx": { - "name": "org_member_to_identity_idx", + "space_id_idx": { + "name": "space_id_idx", "columns": [ - "identity_id", - "org_member_id" - ] + "space_id" + ], + "isUnique": false }, - "team_to_identity_idx": { - "name": "team_to_identity_idx", + "team_id_idx": { + "name": "team_id_idx", "columns": [ - "identity_id", "team_id" + ], + "isUnique": false + }, + "org_member_id_idx": { + "name": "org_member_id_idx", + "columns": [ + "org_member_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_routing_rules_destinations_id": { + "name": "email_routing_rules_destinations_id", + "columns": [ + "id" ] } - } + }, + "uniqueConstraints": {} }, - "email_identities_personal": { - "name": "email_identities_personal", + "org_billing": { + "name": "org_billing", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true - }, - "public_id": { - "autoincrement": false, - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true - }, - "account_id": { - "autoincrement": false, - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "email_identity_id": { - "autoincrement": false, - "name": "email_identity_id", - "type": "bigint unsigned", + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "created_at": { + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "plan": { + "name": "plan", + "type": "enum('starter','pro')", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "created_at", - "type": "timestamp", + "default": "'starter'" + }, + "period": { + "name": "period", + "type": "enum('monthly','yearly')", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "email_identities_personal_id": { - "name": "email_identities_personal_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false, + "default": "'monthly'" } }, "indexes": { - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, "org_id_idx": { "name": "org_id_idx", "columns": [ @@ -2292,399 +2991,452 @@ ], "isUnique": false }, - "email_identity_id_idx": { - "name": "email_identity_id_idx", + "stripe_customer_id_idx": { + "name": "stripe_customer_id_idx", "columns": [ - "email_identity_id" + "stripe_customer_id" ], - "isUnique": false + "isUnique": true + }, + "stripe_subscription_id_idx": { + "name": "stripe_subscription_id_idx", + "columns": [ + "stripe_subscription_id" + ], + "isUnique": true } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "org_billing_id": { + "name": "org_billing_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "email_identity_external": { - "name": "email_identity_external", + "org_invitations": { + "name": "org_invitations", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "public_id": { - "autoincrement": false, "name": "public_id", - "type": "char(30)", + "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "nickname": { - "autoincrement": false, - "name": "nickname", - "type": "varchar(128)", + "invited_by_org_member_id": { + "name": "invited_by_org_member_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "created_by": { - "autoincrement": false, - "name": "created_by", - "type": "bigint unsigned", + "role": { + "name": "role", + "type": "enum('member','admin')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "username": { - "autoincrement": false, - "name": "username", - "type": "varchar(128)", + "org_member_id": { + "name": "org_member_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "password": { - "autoincrement": false, - "name": "password", - "type": "varchar(128)", + "invited_org_member_profile_id": { + "name": "invited_org_member_profile_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "hostname": { - "autoincrement": false, - "name": "hostname", + "email": { + "name": "email", "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "port": { - "autoincrement": false, - "name": "port", - "type": "smallint", + "invite_token": { + "name": "invite_token", + "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "auth_method": { - "autoincrement": false, - "name": "auth_method", - "type": "enum('plain','login')", + "invited_at": { + "name": "invited_at", + "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "encryption": { - "default": "'none'", - "autoincrement": false, - "name": "encryption", - "type": "enum('ssl','tls','starttls','none')", + "expires_at": { + "name": "expires_at", + "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "created_at": { - "autoincrement": false, - "name": "created_at", + "accepted_at": { + "name": "accepted_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "email_identity_external_id": { - "name": "email_identity_external_id", - "columns": [ - "id" - ] + "notNull": false, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ "org_id" ], "isUnique": false + }, + "org_member_id_idx": { + "name": "org_member_id_idx", + "columns": [ + "org_member_id" + ], + "isUnique": true + }, + "org_email_unique_idx": { + "name": "org_email_unique_idx", + "columns": [ + "org_id", + "email" + ], + "isUnique": true } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "org_invitations_id": { + "name": "org_invitations_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "email_routing_rules": { - "name": "email_routing_rules", + "org_member_profiles": { + "name": "org_member_profiles", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", - "type": "char(29)", + "type": "char(30)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_id": { - "autoincrement": false, - "name": "org_id", + "avatar_timestamp": { + "name": "avatar_timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "account_id": { + "name": "account_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "name": { - "autoincrement": false, - "name": "name", - "type": "varchar(128)", + "first_name": { + "name": "first_name", + "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "description": { - "autoincrement": false, - "name": "description", - "type": "text", + "last_name": { + "name": "last_name", + "type": "varchar(64)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, - "created_by": { - "autoincrement": false, - "name": "created_by", - "type": "bigint unsigned", + "handle": { + "name": "handle", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "blurb": { + "name": "blurb", + "type": "text", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "email_routing_rules_id": { - "name": "email_routing_rules_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { - "org_id_idx": { - "name": "org_id_idx", + "public_id_idx": { + "name": "public_id_idx", "columns": [ - "org_id" + "public_id" + ], + "isUnique": true + }, + "account_id_idx": { + "name": "account_id_idx", + "columns": [ + "account_id" ], "isUnique": false } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "org_member_profiles_id": { + "name": "org_member_profiles_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "email_routing_rules_destinations": { - "name": "email_routing_rules_destinations", + "org_members": { + "name": "org_members", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", - "type": "char(30)", + "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_id": { - "autoincrement": false, - "name": "org_id", + "account_id": { + "name": "account_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "rule_id": { - "autoincrement": false, - "name": "rule_id", + "invited_by_org_member_id": { + "name": "invited_by_org_member_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "team_id": { - "autoincrement": false, - "name": "team_id", + "status": { + "name": "status", + "type": "enum('invited','active','removed')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "enum('member','admin')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "personal_space_id": { + "name": "personal_space_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, - "org_member_id": { - "autoincrement": false, - "name": "org_member_id", + "org_member_profile_id": { + "name": "org_member_profile_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "created_at": { - "autoincrement": false, - "name": "created_at", + "default_email_identity_id": { + "name": "default_email_identity_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "added_at": { + "name": "added_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "email_routing_rules_destinations_id": { - "name": "email_routing_rules_destinations_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false + }, + "removed_at": { + "name": "removed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { - "org_id_idx": { - "name": "org_id_idx", + "public_id_idx": { + "name": "public_id_idx", "columns": [ - "org_id" + "public_id" ], - "isUnique": false + "isUnique": true }, - "rule_id_idx": { - "name": "rule_id_idx", + "account_id_idx": { + "name": "account_id_idx", "columns": [ - "rule_id" + "account_id" ], "isUnique": false }, - "team_id_idx": { - "name": "team_id_idx", + "org_id_idx": { + "name": "org_id_idx", "columns": [ - "team_id" + "org_id" ], "isUnique": false }, - "org_member_id_idx": { - "name": "org_member_id_idx", + "org_account_idx": { + "name": "org_account_idx", "columns": [ - "org_member_id" + "org_id", + "account_id" ], - "isUnique": false + "isUnique": true } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "org_members_id": { + "name": "org_members_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "org_billing": { - "name": "org_billing", + "org_modules": { + "name": "org_modules", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "stripe_customer_id": { - "autoincrement": false, - "name": "stripe_customer_id", - "type": "varchar(128)", + "module": { + "name": "module", + "type": "enum('strip signatures','anonymous analytics')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "stripe_subscription_id": { + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "stripe_subscription_id", - "type": "varchar(128)", + "default": false + }, + "last_modified_by_org_member": { + "name": "last_modified_by_org_member", + "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "plan": { - "default": "'starter'", - "autoincrement": false, - "name": "plan", - "type": "enum('starter','pro')", + "last_modified_at": { + "name": "last_modified_at", + "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "period": { - "default": "'monthly'", - "autoincrement": false, - "name": "period", - "type": "enum('monthly','yearly')", + "created_at": { + "name": "created_at", + "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "org_billing_id": { - "name": "org_billing_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -2694,124 +3446,64 @@ "org_id" ], "isUnique": false + }, + "org_module_idx": { + "name": "org_module_idx", + "columns": [ + "org_id", + "module" + ], + "isUnique": true } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "org_modules_id": { + "name": "org_modules_id", "columns": [ "id" ] - }, - "stripe_customer_id_idx": { - "name": "stripe_customer_id_idx", - "columns": [ - "stripe_customer_id" - ] - }, - "stripe_subscription_id_idx": { - "name": "stripe_subscription_id_idx", - "columns": [ - "stripe_subscription_id" - ] } - } + }, + "uniqueConstraints": {} }, - "org_invitations": { - "name": "org_invitations", + "org_postal_configs": { + "name": "org_postal_configs", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true - }, - "public_id": { - "autoincrement": false, - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true - }, - "invited_by_org_member_id": { - "autoincrement": false, - "name": "invited_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true - }, - "role": { - "autoincrement": false, - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true - }, - "org_member_id": { - "autoincrement": false, - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false - }, - "invited_org_member_profile_id": { - "autoincrement": false, - "name": "invited_org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false - }, - "email": { - "autoincrement": false, - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false - }, - "invite_token": { - "autoincrement": false, - "name": "invite_token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "invited_at": { - "autoincrement": false, - "name": "invited_at", - "type": "timestamp", + "host": { + "name": "host", + "type": "varchar(32)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "expires_at": { - "autoincrement": false, - "name": "expires_at", - "type": "timestamp", + "ip_pools": { + "name": "ip_pools", + "type": "json", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "accepted_at": { - "autoincrement": false, - "name": "accepted_at", - "type": "timestamp", + "default_ip_pool": { + "name": "default_ip_pool", + "type": "varchar(32)", "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "org_invitations_id": { - "name": "org_invitations_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { @@ -2824,237 +3516,165 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "org_postal_configs_id": { + "name": "org_postal_configs_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ] - }, - "org_email_unique_idx": { - "name": "org_email_unique_idx", - "columns": [ - "org_id", - "email" - ] } - } + }, + "uniqueConstraints": {} }, - "org_member_profiles": { - "name": "org_member_profiles", + "orgs": { + "name": "orgs", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "public_id": { - "autoincrement": false, "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true - }, - "org_id": { - "autoincrement": false, - "name": "org_id", - "type": "bigint unsigned", + "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "avatar_timestamp": { - "autoincrement": false, "name": "avatar_timestamp", "type": "timestamp", "primaryKey": false, - "notNull": false - }, - "account_id": { - "autoincrement": false, - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, - "first_name": { - "autoincrement": false, - "name": "first_name", + "shortcode": { + "name": "shortcode", "type": "varchar(64)", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "last_name": { - "autoincrement": false, - "name": "last_name", - "type": "varchar(64)", + "owner_id": { + "name": "owner_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "handle": { - "autoincrement": false, - "name": "handle", + "name": { + "name": "name", "type": "varchar(64)", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "title": { - "autoincrement": false, - "name": "title", - "type": "varchar(64)", + "metadata": { + "name": "metadata", + "type": "json", "primaryKey": false, - "notNull": false - }, - "blurb": { + "notNull": false, "autoincrement": false, - "name": "blurb", - "type": "text", + "default": "('{}')" + }, + "migrated_to_spaces": { + "name": "migrated_to_spaces", + "type": "boolean", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false, + "default": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "org_member_profiles_id": { - "name": "org_member_profiles_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { - "account_id_idx": { - "name": "account_id_idx", + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "shortcode_idx": { + "name": "shortcode_idx", "columns": [ - "account_id" + "shortcode" ], - "isUnique": false + "isUnique": true } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "orgs_id": { + "name": "orgs_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "org_members": { - "name": "org_members", + "pending_attachments": { + "name": "pending_attachments", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true - }, - "public_id": { - "autoincrement": false, - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true - }, - "account_id": { - "autoincrement": false, - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true - }, - "invited_by_org_member_id": { - "autoincrement": false, - "name": "invited_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false - }, - "status": { - "autoincrement": false, - "name": "status", - "type": "enum('invited','active','removed')", - "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "role": { - "autoincrement": false, - "name": "role", - "type": "enum('member','admin')", + "public_id": { + "name": "public_id", + "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_member_profile_id": { - "autoincrement": false, - "name": "org_member_profile_id", - "type": "bigint unsigned", + "org_public_id": { + "name": "org_public_id", + "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "added_at": { - "autoincrement": false, - "name": "added_at", - "type": "timestamp", + "filename": { + "name": "filename", + "type": "varchar(256)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "removed_at": { - "autoincrement": false, - "name": "removed_at", + "created_at": { + "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "org_members_id": { - "name": "org_members_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { - "account_id_idx": { - "name": "account_id_idx", + "public_id_idx": { + "name": "public_id_idx", "columns": [ - "account_id" + "public_id" ], - "isUnique": false + "isUnique": true }, "org_id_idx": { "name": "org_id_idx", @@ -3065,91 +3685,77 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "pending_attachments_id": { + "name": "pending_attachments_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] - }, - "org_account_idx": { - "name": "org_account_idx", - "columns": [ - "org_id", - "account_id" - ] } - } + }, + "uniqueConstraints": {} }, - "org_modules": { - "name": "org_modules", + "postal_servers": { + "name": "postal_servers", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "module": { - "autoincrement": false, - "name": "module", - "type": "enum('strip signatures','anonymous analytics')", + "public_id": { + "name": "public_id", + "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "enabled": { - "default": 0, - "autoincrement": false, - "name": "enabled", - "type": "tinyint", + "type": { + "name": "type", + "type": "enum('email','transactional','marketing')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "last_modified_by_org_member": { - "autoincrement": false, - "name": "last_modified_by_org_member", - "type": "bigint unsigned", + "api_key": { + "name": "api_key", + "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "last_modified_at": { - "autoincrement": false, - "name": "last_modified_at", - "type": "timestamp", + "smtp_key": { + "name": "smtp_key", + "type": "varchar(64)", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, - "created_at": { - "autoincrement": false, - "name": "created_at", - "type": "timestamp", + "root_forwarding_address": { + "name": "root_forwarding_address", + "type": "varchar(128)", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "org_modules_id": { - "name": "org_modules_id", - "columns": [ - "id" - ] + "notNull": false, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ @@ -3159,543 +3765,837 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "postal_servers_id": { + "name": "postal_servers_id", "columns": [ "id" ] - }, - "org_module_idx": { - "name": "org_module_idx", - "columns": [ - "org_id", - "module" - ] } - } + }, + "uniqueConstraints": {} }, - "org_postal_configs": { - "name": "org_postal_configs", + "sessions": { + "name": "sessions", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, - "org_id": { - "autoincrement": false, - "name": "org_id", + "public_id": { + "name": "public_id", + "type": "char(29)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "account_id": { + "name": "account_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "host": { - "autoincrement": false, - "name": "host", - "type": "varchar(32)", + "account_public_id": { + "name": "account_public_id", + "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "ip_pools": { - "autoincrement": false, - "name": "ip_pools", - "type": "json", + "session_token": { + "name": "session_token", + "type": "varchar(255)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "default_ip_pool": { - "autoincrement": false, - "name": "default_ip_pool", - "type": "varchar(32)", + "device": { + "name": "device", + "type": "varchar(255)", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "org_postal_configs_id": { - "name": "org_postal_configs_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false + }, + "os": { + "name": "os", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false } }, "indexes": { - "org_id_idx": { - "name": "org_id_idx", + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, + "account_id_idx": { + "name": "account_id_idx", + "columns": [ + "account_id" + ], + "isUnique": false + }, + "session_token_idx": { + "name": "session_token_idx", + "columns": [ + "session_token" + ], + "isUnique": true + }, + "expires_at_idx": { + "name": "expires_at_idx", "columns": [ - "org_id" + "expires_at" ], "isUnique": false } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "sessions_id": { + "name": "sessions_id", "columns": [ "id" ] } - } + }, + "uniqueConstraints": {} }, - "orgs": { - "name": "orgs", + "space_members": { + "name": "space_members", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", - "type": "char(28)", + "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "avatar_timestamp": { + "space_id": { + "name": "space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "org_member_id": { + "name": "org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "enum('member','admin')", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "avatar_timestamp", + "default": "'member'" + }, + "notifications": { + "name": "notifications", + "type": "enum('active','muted','off')", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "added_by_org_member_id": { + "name": "added_by_org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_at": { + "name": "added_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false }, - "shortcode": { + "removed_at": { + "name": "removed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "can_create": { + "name": "can_create", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "shortcode", - "type": "varchar(64)", + "default": true + }, + "can_read": { + "name": "can_read", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": true }, - "owner_id": { + "can_comment": { + "name": "can_comment", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "owner_id", - "type": "bigint unsigned", + "default": true + }, + "can_reply": { + "name": "can_reply", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": true }, - "name": { + "can_delete": { + "name": "can_delete", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "name", - "type": "varchar(64)", + "default": true + }, + "can_change_workflow": { + "name": "can_change_workflow", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": true }, - "metadata": { - "default": "('{}')", + "can_set_workflow_to_closed": { + "name": "can_set_workflow_to_closed", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "metadata", - "type": "json", + "default": true + }, + "can_add_tags": { + "name": "can_add_tags", + "type": "boolean", "primaryKey": false, - "notNull": false + "notNull": true, + "autoincrement": false, + "default": true }, - "created_at": { + "can_move_to_another_space": { + "name": "can_move_to_another_space", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "created_at", - "type": "timestamp", + "default": true + }, + "can_add_to_another_space": { + "name": "can_add_to_another_space", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "can_merge": { + "name": "can_merge", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "can_add_participants": { + "name": "can_add_participants", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": true } }, - "compositePrimaryKeys": { - "orgs_id": { - "name": "orgs_id", + "indexes": { + "org_id_idx": { + "name": "org_id_idx", "columns": [ - "id" - ] + "org_id" + ], + "isUnique": false + }, + "space_id_idx": { + "name": "space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "org_member_id_idx": { + "name": "org_member_id_idx", + "columns": [ + "org_member_id" + ], + "isUnique": false } }, - "indexes": {}, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "space_members_id": { + "name": "space_members_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] - }, - "shortcode_idx": { - "name": "shortcode_idx", - "columns": [ - "shortcode" - ] } - } + }, + "uniqueConstraints": {} }, - "pending_attachments": { - "name": "pending_attachments", + "space_tags": { + "name": "space_tags", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_id": { - "autoincrement": false, - "name": "org_id", + "space_id": { + "name": "space_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_public_id": { - "autoincrement": false, - "name": "org_public_id", - "type": "char(28)", + "label": { + "name": "label", + "type": "varchar(32)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "filename": { + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "icon": { + "name": "icon", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "filename", - "type": "varchar(256)", + "default": "'tag-simple'" + }, + "created_by_org_member_id": { + "name": "created_by_org_member_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "created_at": { + "disabled": { + "name": "disabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, + "default": false + }, + "created_at": { "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "pending_attachments_id": { - "name": "pending_attachments_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ "org_id" ], "isUnique": false + }, + "space_id_idx": { + "name": "space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "created_by_org_member_id_idx": { + "name": "created_by_org_member_id_idx", + "columns": [ + "created_by_org_member_id" + ], + "isUnique": false } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "space_tags_id": { + "name": "space_tags_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "postal_servers": { - "name": "postal_servers", + "space_workflows": { + "name": "space_workflows", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "org_id": { - "autoincrement": false, - "name": "org_id", + "space_id": { + "name": "space_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "type": { - "autoincrement": false, "name": "type", - "type": "enum('email','transactional','marketing')", + "type": "enum('open','active','closed')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "api_key": { - "autoincrement": false, - "name": "api_key", - "type": "varchar(64)", + "order": { + "name": "order", + "type": "tinyint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "smtp_key": { + "name": { + "name": "name", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "icon": { + "name": "icon", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "smtp_key", - "type": "varchar(64)", + "default": "'check'" + }, + "description": { + "name": "description", + "type": "text", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, - "root_forwarding_address": { + "disabled": { + "name": "disabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "root_forwarding_address", - "type": "varchar(128)", + "default": false + }, + "created_by_org_member_id": { + "name": "created_by_org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", "primaryKey": false, - "notNull": false - } - }, - "compositePrimaryKeys": { - "postal_servers_id": { - "name": "postal_servers_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ "org_id" ], "isUnique": false + }, + "space_id_idx": { + "name": "space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "space_workflows_id": { + "name": "space_workflows_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, - "sessions": { - "name": "sessions", + "spaces": { + "name": "spaces", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, - "public_id": { - "autoincrement": false, - "name": "public_id", - "type": "char(29)", + "org_id": { + "name": "org_id", + "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "account_id": { - "autoincrement": false, - "name": "account_id", + "parent_space_id": { + "name": "parent_space_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "account_public_id": { - "autoincrement": false, - "name": "account_public_id", + "public_id": { + "name": "public_id", "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "session_token": { - "autoincrement": false, - "name": "session_token", - "type": "varchar(255)", + "shortcode": { + "name": "shortcode", + "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "device": { + "type": { + "name": "type", + "type": "enum('open','private')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "personal_space": { + "name": "personal_space", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "device", - "type": "varchar(255)", + "default": false + }, + "convo_prefix": { + "name": "convo_prefix", + "type": "varchar(8)", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, - "os": { + "inherit_parent_permissions": { + "name": "inherit_parent_permissions", + "type": "boolean", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "os", - "type": "varchar(255)", + "default": false + }, + "name": { + "name": "name", + "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, - "expires_at": { + "icon": { + "name": "icon", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, "autoincrement": false, - "name": "expires_at", + "default": "'squares-four'" + }, + "color": { + "name": "color", + "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "avatar_timestamp": { + "name": "avatar_timestamp", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false + }, + "created_by_org_member_id": { + "name": "created_by_org_member_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "sessions_id": { - "name": "sessions_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { - "account_id_idx": { - "name": "account_id_idx", + "public_id_idx": { + "name": "public_id_idx", "columns": [ - "account_id" + "public_id" + ], + "isUnique": true + }, + "shortcode_idx": { + "name": "shortcode_idx", + "columns": [ + "shortcode" ], "isUnique": false }, - "expires_at_idx": { - "name": "expires_at_idx", + "shortcode_org_unique_idx": { + "name": "shortcode_org_unique_idx", "columns": [ - "expires_at" + "shortcode", + "org_id" + ], + "isUnique": true + }, + "org_id_idx": { + "name": "org_id_idx", + "columns": [ + "org_id" ], "isUnique": false } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "spaces_id": { + "name": "spaces_id", "columns": [ "id" ] - }, - "session_token_idx": { - "name": "session_token_idx", - "columns": [ - "session_token" - ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} }, "team_members": { "name": "team_members", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true }, "org_id": { - "autoincrement": false, "name": "org_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(29)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "team_id": { - "autoincrement": false, "name": "team_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "org_member_id": { - "autoincrement": false, "name": "org_member_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "org_member_profile_id": { - "autoincrement": false, "name": "org_member_profile_id", "type": "bigint unsigned", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "added_by": { - "autoincrement": false, "name": "added_by", "type": "bigint unsigned", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "role": { - "default": "'member'", - "autoincrement": false, "name": "role", "type": "enum('member','admin')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": "'member'" }, "notifications": { - "default": "'active'", - "autoincrement": false, "name": "notifications", "type": "enum('active','muted','off')", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false, + "default": "'active'" }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "team_members_id": { - "name": "team_members_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "team_id_idx": { + "name": "team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, "org_member_id_idx": { "name": "org_member_id_idx", "columns": [ @@ -3703,100 +4603,108 @@ ], "isUnique": false }, - "team_id_idx": { - "name": "team_id_idx", + "org_member_to_team_idx": { + "name": "org_member_to_team_idx", "columns": [ - "team_id" + "team_id", + "org_member_id" ], - "isUnique": false + "isUnique": true } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "team_members_id": { + "name": "team_members_id", "columns": [ "id" ] - }, - "org_member_to_team_idx": { - "name": "org_member_to_team_idx", - "columns": [ - "team_id", - "org_member_id" - ] } - } + }, + "uniqueConstraints": {} }, "teams": { "name": "teams", "columns": { "id": { - "autoincrement": true, "name": "id", "type": "serial", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": true + }, + "org_id": { + "name": "org_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, "public_id": { - "autoincrement": false, "name": "public_id", "type": "char(28)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "avatar_timestamp": { - "autoincrement": false, "name": "avatar_timestamp", "type": "timestamp", "primaryKey": false, - "notNull": false - }, - "org_id": { - "autoincrement": false, - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true + "notNull": false, + "autoincrement": false }, "name": { - "autoincrement": false, "name": "name", "type": "varchar(128)", "primaryKey": false, - "notNull": true + "notNull": true, + "autoincrement": false }, "color": { - "autoincrement": false, "name": "color", "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false }, "description": { - "autoincrement": false, "name": "description", "type": "text", "primaryKey": false, - "notNull": false + "notNull": false, + "autoincrement": false + }, + "default_email_identity_id": { + "name": "default_email_identity_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_space_id": { + "name": "default_space_id", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false }, "created_at": { - "autoincrement": false, "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true - } - }, - "compositePrimaryKeys": { - "teams_id": { - "name": "teams_id", - "columns": [ - "id" - ] + "notNull": true, + "autoincrement": false } }, "indexes": { + "public_id_idx": { + "name": "public_id_idx", + "columns": [ + "public_id" + ], + "isUnique": true + }, "org_id_idx": { "name": "org_id_idx", "columns": [ @@ -3806,20 +4714,15 @@ } }, "foreignKeys": {}, - "uniqueConstraints": { - "id": { - "name": "id", + "compositePrimaryKeys": { + "teams_id": { + "name": "teams_id", "columns": [ "id" ] - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ] } - } + }, + "uniqueConstraints": {} } }, "_meta": { @@ -3828,22 +4731,7 @@ "columns": {} }, "internal": { - "tables": { - "convo_entries": { - "columns": { - "metadata": { - "isDefaultAnExpression": true - } - } - }, - "orgs": { - "columns": { - "metadata": { - "isDefaultAnExpression": true - } - } - } - }, + "tables": {}, "indexes": {} } } \ No newline at end of file diff --git a/packages/database/migrations/meta/0001_snapshot.json b/packages/database/migrations/meta/0001_snapshot.json deleted file mode 100644 index 6314afd1..00000000 --- a/packages/database/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,4725 +0,0 @@ -{ - "version": "5", - "dialect": "mysql", - "id": "6e186775-9d48-4ac1-b830-a271c08d3117", - "prevId": "00000000-0000-0000-0000-000000000000", - "tables": { - "account_credentials": { - "name": "account_credentials", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_secret": { - "name": "two_factor_secret", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "recovery_code": { - "name": "recovery_code", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "account_credentials_id": { - "name": "account_credentials_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "accounts": { - "name": "accounts", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_login_at": { - "name": "last_login_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recovery_email_hash": { - "name": "recovery_email_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recovery_email_verified_at": { - "name": "recovery_email_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_secret": { - "name": "two_factor_secret", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "recovery_code": { - "name": "recovery_code", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pre_account": { - "name": "pre_account", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "username_idx": { - "name": "username_idx", - "columns": [ - "username" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "accounts_id": { - "name": "accounts_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "authenticators": { - "name": "authenticators", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_credential_id": { - "name": "account_credential_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "nickname": { - "name": "nickname", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_id": { - "name": "credential_id", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_public_key": { - "name": "credential_public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "counter": { - "name": "counter", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_device_type": { - "name": "credential_device_type", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_backed_up": { - "name": "credential_backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "transports": { - "name": "transports", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "provider_account_id_idx": { - "name": "provider_account_id_idx", - "columns": [ - "account_credential_id" - ], - "isUnique": false - }, - "credential_id_idx": { - "name": "credential_id_idx", - "columns": [ - "credential_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "authenticators_id": { - "name": "authenticators_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "contact_global_reputations": { - "name": "contact_global_reputations", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "email_address": { - "name": "email_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "spam": { - "name": "spam", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "cold": { - "name": "cold", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "newsletter": { - "name": "newsletter", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "marketing": { - "name": "marketing", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "product": { - "name": "product", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "message_count": { - "name": "message_count", - "type": "mediumint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_updated": { - "name": "last_updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "email_address_idx": { - "name": "email_address_idx", - "columns": [ - "email_address" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "contact_global_reputations_id": { - "name": "contact_global_reputations_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reputation_id": { - "name": "reputation_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "set_name": { - "name": "set_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_username": { - "name": "email_username", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_domain": { - "name": "email_domain", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature_html": { - "name": "signature_html", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('person','product','newsletter','marketing','unknown')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "screener_status": { - "name": "screener_status", - "type": "enum('pending','approve','reject')", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "email_idx": { - "name": "email_idx", - "columns": [ - "email_username", - "email_domain" - ], - "isUnique": false - }, - "email_org_unique_idx": { - "name": "email_org_unique_idx", - "columns": [ - "email_username", - "email_domain", - "org_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "contacts_id": { - "name": "contacts_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_attachments": { - "name": "convo_attachments", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_entry_id": { - "name": "convo_entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "fileName": { - "name": "fileName", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size": { - "name": "size", - "type": "int unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inline": { - "name": "inline", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "public": { - "name": "public", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "convo_participant_id": { - "name": "convo_participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "convo_entry_id_idx": { - "name": "convo_entry_id_idx", - "columns": [ - "convo_entry_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_attachments_id": { - "name": "convo_attachments_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entries": { - "name": "convo_entries", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('message','comment','draft')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_id": { - "name": "subject_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "author": { - "name": "author", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "json", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_plain_text": { - "name": "body_plain_text", - "type": "longtext", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_cleaned_html": { - "name": "body_cleaned_html", - "type": "longtext", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "('{}')" - }, - "email_message_id": { - "name": "email_message_id", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "enum('private','internal_participants','org','all_participants')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "subject_id_idx": { - "name": "subject_id_idx", - "columns": [ - "subject_id" - ], - "isUnique": false - }, - "author_idx": { - "name": "author_idx", - "columns": [ - "author" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "type_idx": { - "name": "type_idx", - "columns": [ - "type" - ], - "isUnique": false - }, - "reply_to_id_idx": { - "name": "reply_to_id_idx", - "columns": [ - "reply_to_id" - ], - "isUnique": false - }, - "created_at_idx": { - "name": "created_at_idx", - "columns": [ - "created_at" - ], - "isUnique": false - }, - "email_message_id_idx": { - "name": "email_message_id_idx", - "columns": [ - "email_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entries_id": { - "name": "convo_entries_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_private_visibility_participants": { - "name": "convo_entry_private_visibility_participants", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entry_id": { - "name": "entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_member_id": { - "name": "convo_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "entry_id_idx": { - "name": "entry_id_idx", - "columns": [ - "entry_id" - ], - "isUnique": false - }, - "convo_member_id_idx": { - "name": "convo_member_id_idx", - "columns": [ - "convo_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entry_private_visibility_participants_id": { - "name": "convo_entry_private_visibility_participants_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_raw_html_emails": { - "name": "convo_entry_raw_html_emails", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entry_id": { - "name": "entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "headers": { - "name": "headers", - "type": "json", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "html": { - "name": "html", - "type": "mediumtext", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "wipe_date": { - "name": "wipe_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "keep": { - "name": "keep", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "wiped": { - "name": "wiped", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "entry_id_idx": { - "name": "entry_id_idx", - "columns": [ - "entry_id" - ], - "isUnique": false - }, - "wipe_date_idx": { - "name": "wipe_date_idx", - "columns": [ - "wipe_date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entry_raw_html_emails_id": { - "name": "convo_entry_raw_html_emails_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_replies": { - "name": "convo_entry_replies", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_message_source_id": { - "name": "convo_message_source_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_message_reply_id": { - "name": "convo_message_reply_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "entry_source_id_idx": { - "name": "entry_source_id_idx", - "columns": [ - "convo_message_source_id" - ], - "isUnique": false - }, - "entry_reply_id_idx": { - "name": "entry_reply_id_idx", - "columns": [ - "convo_message_reply_id" - ], - "isUnique": false - }, - "created_at_idx": { - "name": "created_at_idx", - "columns": [ - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entry_replies_id": { - "name": "convo_entry_replies_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_seen_timestamps": { - "name": "convo_entry_seen_timestamps", - "columns": { - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_entry_id": { - "name": "convo_entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "participant_id": { - "name": "participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "seen_at": { - "name": "seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "convo_entry_id_idx": { - "name": "convo_entry_id_idx", - "columns": [ - "convo_entry_id" - ], - "isUnique": false - }, - "participant_id_idx": { - "name": "participant_id_idx", - "columns": [ - "participant_id" - ], - "isUnique": false - }, - "seen_at_idx": { - "name": "seen_at_idx", - "columns": [ - "seen_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "id": { - "name": "id", - "columns": [ - "convo_entry_id", - "participant_id", - "org_member_id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_participant_team_members": { - "name": "convo_participant_team_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_participant_id": { - "name": "convo_participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "convo_participant_id_idx": { - "name": "convo_participant_id_idx", - "columns": [ - "convo_participant_id" - ], - "isUnique": false - }, - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_participant_team_members_id": { - "name": "convo_participant_team_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_participants": { - "name": "convo_participants", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('assigned','contributor','commenter','watcher','teamMember','guest')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'contributor'" - }, - "email_identity_id": { - "name": "email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notifications": { - "name": "notifications", - "type": "enum('active','muted','off')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "last_read_at": { - "name": "last_read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "active": { - "name": "active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "hidden": { - "name": "hidden", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "org_member_to_convo_idx": { - "name": "org_member_to_convo_idx", - "columns": [ - "convo_id", - "org_member_id" - ], - "isUnique": true - }, - "team_to_convo_idx": { - "name": "team_to_convo_idx", - "columns": [ - "convo_id", - "team_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_participants_id": { - "name": "convo_participants_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_seen_timestamps": { - "name": "convo_seen_timestamps", - "columns": { - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "participant_id": { - "name": "participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "seen_at": { - "name": "seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "seen_at_idx": { - "name": "seen_at_idx", - "columns": [ - "seen_at" - ], - "isUnique": false - }, - "participant_id_idx": { - "name": "participant_id_idx", - "columns": [ - "participant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "id": { - "name": "id", - "columns": [ - "convo_id", - "participant_id", - "org_member_id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_subjects": { - "name": "convo_subjects", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_subjects_id": { - "name": "convo_subjects_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_tags": { - "name": "convo_tags", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_to_space_id": { - "name": "convo_to_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "added_by_org_member_id": { - "name": "added_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "added_at": { - "name": "added_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "convo_to_spaces_id_idx": { - "name": "convo_to_spaces_id_idx", - "columns": [ - "convo_to_space_id" - ], - "isUnique": false - }, - "tag_idx": { - "name": "tag_idx", - "columns": [ - "tag_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_tags_id": { - "name": "convo_tags_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_to_spaces": { - "name": "convo_to_spaces", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_to_spaces_id": { - "name": "convo_to_spaces_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_workflows": { - "name": "convo_workflows", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_to_space_id": { - "name": "convo_to_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "workflow_id": { - "name": "workflow_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "by_org_member_id": { - "name": "by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "convo_to_spaces_id_idx": { - "name": "convo_to_spaces_id_idx", - "columns": [ - "convo_to_space_id" - ], - "isUnique": false - }, - "workflow_idx": { - "name": "workflow_idx", - "columns": [ - "workflow_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_workflows_id": { - "name": "convo_workflows_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convos": { - "name": "convos", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_updated_at": { - "name": "last_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "created_at_idx": { - "name": "created_at_idx", - "columns": [ - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convos_id": { - "name": "convos_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "domains": { - "name": "domains", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disabled": { - "name": "disabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "catch_all_address": { - "name": "catch_all_address", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "postal_host": { - "name": "postal_host", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "domain": { - "name": "domain", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "forwarding_address": { - "name": "forwarding_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "postal_id": { - "name": "postal_id", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "domain_status": { - "name": "domain_status", - "type": "enum('unverified','pending','active','disabled')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unverified'" - }, - "sending_mode": { - "name": "sending_mode", - "type": "enum('native','external','disabled')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "receiving_mode": { - "name": "receiving_mode", - "type": "enum('native','forwarding','disabled')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "dkim_key": { - "name": "dkim_key", - "type": "varchar(32)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dkim_value": { - "name": "dkim_value", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mx_dns_valid": { - "name": "mx_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "dkim_dns_valid": { - "name": "dkim_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "spf_dns_valid": { - "name": "spf_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "return_path_dns_valid": { - "name": "return_path_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_dns_check_at": { - "name": "last_dns_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "disabled_at": { - "name": "disabled_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "domain_name_idx": { - "name": "domain_name_idx", - "columns": [ - "domain" - ], - "isUnique": false - }, - "domain_org_idx": { - "name": "domain_org_idx", - "columns": [ - "domain", - "org_id" - ], - "isUnique": true - }, - "postal_id_idx": { - "name": "postal_id_idx", - "columns": [ - "postal_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "domains_id": { - "name": "domains_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identities": { - "name": "email_identities", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "domain_name": { - "name": "domain_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "domain_id": { - "name": "domain_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "routing_rule_id": { - "name": "routing_rule_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "send_name": { - "name": "send_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_catch_all": { - "name": "is_catch_all", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "personal_email_identity_id": { - "name": "personal_email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_credentials_id": { - "name": "external_credentials_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "forwarding_address": { - "name": "forwarding_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "domain_id_idx": { - "name": "domain_id_idx", - "columns": [ - "domain_name" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "email_idx": { - "name": "email_idx", - "columns": [ - "username", - "domain_name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identities_id": { - "name": "email_identities_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identities_authorized_org_members": { - "name": "email_identities_authorized_org_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "identity_id": { - "name": "identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "added_by": { - "name": "added_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "identity_id_idx": { - "name": "identity_id_idx", - "columns": [ - "identity_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "org_member_to_identity_idx": { - "name": "org_member_to_identity_idx", - "columns": [ - "identity_id", - "org_member_id" - ], - "isUnique": true - }, - "team_to_identity_idx": { - "name": "team_to_identity_idx", - "columns": [ - "identity_id", - "team_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identities_authorized_org_members_id": { - "name": "email_identities_authorized_org_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identities_personal": { - "name": "email_identities_personal", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_identity_id": { - "name": "email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "email_identity_id_idx": { - "name": "email_identity_id_idx", - "columns": [ - "email_identity_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identities_personal_id": { - "name": "email_identities_personal_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identity_external": { - "name": "email_identity_external", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "nickname": { - "name": "nickname", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "hostname": { - "name": "hostname", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "port": { - "name": "port", - "type": "smallint", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_method": { - "name": "auth_method", - "type": "enum('plain','login')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "encryption": { - "name": "encryption", - "type": "enum('ssl','tls','starttls','none')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identity_external_id": { - "name": "email_identity_external_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_routing_rule_assignees": { - "name": "email_routing_rule_assignees", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rule_destination_id": { - "name": "rule_destination_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "rule_destination_id_idx": { - "name": "rule_destination_id_idx", - "columns": [ - "rule_destination_id" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - }, - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_routing_rule_assignees_id": { - "name": "email_routing_rule_assignees_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_routing_rules": { - "name": "email_routing_rules", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_routing_rules_id": { - "name": "email_routing_rules_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_routing_rules_destinations": { - "name": "email_routing_rules_destinations", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rule_id": { - "name": "rule_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "rule_id_idx": { - "name": "rule_id_idx", - "columns": [ - "rule_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_routing_rules_destinations_id": { - "name": "email_routing_rules_destinations_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_billing": { - "name": "org_billing", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "stripe_customer_id": { - "name": "stripe_customer_id", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "stripe_subscription_id": { - "name": "stripe_subscription_id", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "plan": { - "name": "plan", - "type": "enum('starter','pro')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'starter'" - }, - "period": { - "name": "period", - "type": "enum('monthly','yearly')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'monthly'" - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "stripe_customer_id_idx": { - "name": "stripe_customer_id_idx", - "columns": [ - "stripe_customer_id" - ], - "isUnique": true - }, - "stripe_subscription_id_idx": { - "name": "stripe_subscription_id_idx", - "columns": [ - "stripe_subscription_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_billing_id": { - "name": "org_billing_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_invitations": { - "name": "org_invitations", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_org_member_id": { - "name": "invited_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invited_org_member_profile_id": { - "name": "invited_org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invite_token": { - "name": "invite_token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invited_at": { - "name": "invited_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": true - }, - "org_email_unique_idx": { - "name": "org_email_unique_idx", - "columns": [ - "org_id", - "email" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_invitations_id": { - "name": "org_invitations_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_member_profiles": { - "name": "org_member_profiles", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "handle": { - "name": "handle", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blurb": { - "name": "blurb", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_member_profiles_id": { - "name": "org_member_profiles_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_members": { - "name": "org_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invited_by_org_member_id": { - "name": "invited_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "enum('invited','active','removed')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "personal_space_id": { - "name": "personal_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "org_member_profile_id": { - "name": "org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_email_identity_id": { - "name": "default_email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "added_at": { - "name": "added_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_account_idx": { - "name": "org_account_idx", - "columns": [ - "org_id", - "account_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_members_id": { - "name": "org_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_modules": { - "name": "org_modules", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "module": { - "name": "module", - "type": "enum('strip signatures','anonymous analytics')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_modified_by_org_member": { - "name": "last_modified_by_org_member", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_modified_at": { - "name": "last_modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_module_idx": { - "name": "org_module_idx", - "columns": [ - "org_id", - "module" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_modules_id": { - "name": "org_modules_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_postal_configs": { - "name": "org_postal_configs", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "host": { - "name": "host", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip_pools": { - "name": "ip_pools", - "type": "json", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_ip_pool": { - "name": "default_ip_pool", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_postal_configs_id": { - "name": "org_postal_configs_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "orgs": { - "name": "orgs", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "shortcode": { - "name": "shortcode", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "owner_id": { - "name": "owner_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "('{}')" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "shortcode_idx": { - "name": "shortcode_idx", - "columns": [ - "shortcode" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "orgs_id": { - "name": "orgs_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "pending_attachments": { - "name": "pending_attachments", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_public_id": { - "name": "org_public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "pending_attachments_id": { - "name": "pending_attachments_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "postal_servers": { - "name": "postal_servers", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('email','transactional','marketing')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "api_key": { - "name": "api_key", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "smtp_key": { - "name": "smtp_key", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_forwarding_address": { - "name": "root_forwarding_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "postal_servers_id": { - "name": "postal_servers_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "sessions": { - "name": "sessions", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_public_id": { - "name": "account_public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "session_token": { - "name": "session_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "device": { - "name": "device", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "os": { - "name": "os", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, - "session_token_idx": { - "name": "session_token_idx", - "columns": [ - "session_token" - ], - "isUnique": true - }, - "expires_at_idx": { - "name": "expires_at_idx", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "sessions_id": { - "name": "sessions_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "space_members": { - "name": "space_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'member'" - }, - "notifications": { - "name": "notifications", - "type": "enum('active','muted','off')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "added_by_org_member_id": { - "name": "added_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "added_at": { - "name": "added_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "can_create": { - "name": "can_create", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_read": { - "name": "can_read", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_comment": { - "name": "can_comment", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_reply": { - "name": "can_reply", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_delete": { - "name": "can_delete", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_change_workflow": { - "name": "can_change_workflow", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_set_workflow_to_closed": { - "name": "can_set_workflow_to_closed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_add_tags": { - "name": "can_add_tags", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_move_to_another_space": { - "name": "can_move_to_another_space", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_add_to_another_space": { - "name": "can_add_to_another_space", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_merge": { - "name": "can_merge", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_add_participants": { - "name": "can_add_participants", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "space_members_id": { - "name": "space_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "space_tags": { - "name": "space_tags", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "icon": { - "name": "icon", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tag-simple'" - }, - "created_by_org_member_id": { - "name": "created_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disabled": { - "name": "disabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "created_by_org_member_id_idx": { - "name": "created_by_org_member_id_idx", - "columns": [ - "created_by_org_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "space_tags_id": { - "name": "space_tags_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "space_workflows": { - "name": "space_workflows", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('open','active','closed')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "order": { - "name": "order", - "type": "tinyint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "icon": { - "name": "icon", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'check'" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "disabled": { - "name": "disabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_by_org_member_id": { - "name": "created_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "space_workflows_id": { - "name": "space_workflows_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "spaces": { - "name": "spaces", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_space_id": { - "name": "parent_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "shortcode": { - "name": "shortcode", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('open','private')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "personal_space": { - "name": "personal_space", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "convo_prefix": { - "name": "convo_prefix", - "type": "varchar(8)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inherit_parent_permissions": { - "name": "inherit_parent_permissions", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "icon": { - "name": "icon", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'squares-four'" - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_org_member_id": { - "name": "created_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "shortcode_idx": { - "name": "shortcode_idx", - "columns": [ - "shortcode" - ], - "isUnique": false - }, - "shortcode_org_unique_idx": { - "name": "shortcode_org_unique_idx", - "columns": [ - "shortcode", - "org_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "spaces_id": { - "name": "spaces_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "team_members": { - "name": "team_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_profile_id": { - "name": "org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "added_by": { - "name": "added_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'member'" - }, - "notifications": { - "name": "notifications", - "type": "enum('active','muted','off')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - }, - "org_member_to_team_idx": { - "name": "org_member_to_team_idx", - "columns": [ - "team_id", - "org_member_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "team_members_id": { - "name": "team_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "teams": { - "name": "teams", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_email_identity_id": { - "name": "default_email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_space_id": { - "name": "default_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "teams_id": { - "name": "teams_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - } - }, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "tables": {}, - "indexes": {} - } -} \ No newline at end of file diff --git a/packages/database/migrations/meta/0002_snapshot.json b/packages/database/migrations/meta/0002_snapshot.json deleted file mode 100644 index 83dcfd0e..00000000 --- a/packages/database/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,4733 +0,0 @@ -{ - "version": "5", - "dialect": "mysql", - "id": "fe079eab-6d85-46ff-9ff5-0feadc02b851", - "prevId": "6e186775-9d48-4ac1-b830-a271c08d3117", - "tables": { - "account_credentials": { - "name": "account_credentials", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_secret": { - "name": "two_factor_secret", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "recovery_code": { - "name": "recovery_code", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "account_credentials_id": { - "name": "account_credentials_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "accounts": { - "name": "accounts", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_login_at": { - "name": "last_login_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recovery_email_hash": { - "name": "recovery_email_hash", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recovery_email_verified_at": { - "name": "recovery_email_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_secret": { - "name": "two_factor_secret", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "recovery_code": { - "name": "recovery_code", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pre_account": { - "name": "pre_account", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "username_idx": { - "name": "username_idx", - "columns": [ - "username" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "accounts_id": { - "name": "accounts_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "authenticators": { - "name": "authenticators", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_credential_id": { - "name": "account_credential_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "nickname": { - "name": "nickname", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_id": { - "name": "credential_id", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_public_key": { - "name": "credential_public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "counter": { - "name": "counter", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_device_type": { - "name": "credential_device_type", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credential_backed_up": { - "name": "credential_backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "transports": { - "name": "transports", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "provider_account_id_idx": { - "name": "provider_account_id_idx", - "columns": [ - "account_credential_id" - ], - "isUnique": false - }, - "credential_id_idx": { - "name": "credential_id_idx", - "columns": [ - "credential_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "authenticators_id": { - "name": "authenticators_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "contact_global_reputations": { - "name": "contact_global_reputations", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "email_address": { - "name": "email_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "spam": { - "name": "spam", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "cold": { - "name": "cold", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "newsletter": { - "name": "newsletter", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "marketing": { - "name": "marketing", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "product": { - "name": "product", - "type": "tinyint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "message_count": { - "name": "message_count", - "type": "mediumint", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_updated": { - "name": "last_updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "email_address_idx": { - "name": "email_address_idx", - "columns": [ - "email_address" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "contact_global_reputations_id": { - "name": "contact_global_reputations_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reputation_id": { - "name": "reputation_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "set_name": { - "name": "set_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_username": { - "name": "email_username", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_domain": { - "name": "email_domain", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature_html": { - "name": "signature_html", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('person','product','newsletter','marketing','unknown')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "screener_status": { - "name": "screener_status", - "type": "enum('pending','approve','reject')", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "email_idx": { - "name": "email_idx", - "columns": [ - "email_username", - "email_domain" - ], - "isUnique": false - }, - "email_org_unique_idx": { - "name": "email_org_unique_idx", - "columns": [ - "email_username", - "email_domain", - "org_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "contacts_id": { - "name": "contacts_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_attachments": { - "name": "convo_attachments", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_entry_id": { - "name": "convo_entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "fileName": { - "name": "fileName", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size": { - "name": "size", - "type": "int unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inline": { - "name": "inline", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "public": { - "name": "public", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "convo_participant_id": { - "name": "convo_participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "convo_entry_id_idx": { - "name": "convo_entry_id_idx", - "columns": [ - "convo_entry_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_attachments_id": { - "name": "convo_attachments_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entries": { - "name": "convo_entries", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('message','comment','draft')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_id": { - "name": "subject_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "author": { - "name": "author", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "json", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_plain_text": { - "name": "body_plain_text", - "type": "longtext", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_cleaned_html": { - "name": "body_cleaned_html", - "type": "longtext", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "('{}')" - }, - "email_message_id": { - "name": "email_message_id", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "enum('private','internal_participants','org','all_participants')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "subject_id_idx": { - "name": "subject_id_idx", - "columns": [ - "subject_id" - ], - "isUnique": false - }, - "author_idx": { - "name": "author_idx", - "columns": [ - "author" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "type_idx": { - "name": "type_idx", - "columns": [ - "type" - ], - "isUnique": false - }, - "reply_to_id_idx": { - "name": "reply_to_id_idx", - "columns": [ - "reply_to_id" - ], - "isUnique": false - }, - "created_at_idx": { - "name": "created_at_idx", - "columns": [ - "created_at" - ], - "isUnique": false - }, - "email_message_id_idx": { - "name": "email_message_id_idx", - "columns": [ - "email_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entries_id": { - "name": "convo_entries_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_private_visibility_participants": { - "name": "convo_entry_private_visibility_participants", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entry_id": { - "name": "entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_member_id": { - "name": "convo_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "entry_id_idx": { - "name": "entry_id_idx", - "columns": [ - "entry_id" - ], - "isUnique": false - }, - "convo_member_id_idx": { - "name": "convo_member_id_idx", - "columns": [ - "convo_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entry_private_visibility_participants_id": { - "name": "convo_entry_private_visibility_participants_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_raw_html_emails": { - "name": "convo_entry_raw_html_emails", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entry_id": { - "name": "entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "headers": { - "name": "headers", - "type": "json", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "html": { - "name": "html", - "type": "mediumtext", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "wipe_date": { - "name": "wipe_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "keep": { - "name": "keep", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "wiped": { - "name": "wiped", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "entry_id_idx": { - "name": "entry_id_idx", - "columns": [ - "entry_id" - ], - "isUnique": false - }, - "wipe_date_idx": { - "name": "wipe_date_idx", - "columns": [ - "wipe_date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entry_raw_html_emails_id": { - "name": "convo_entry_raw_html_emails_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_replies": { - "name": "convo_entry_replies", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_message_source_id": { - "name": "convo_message_source_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_message_reply_id": { - "name": "convo_message_reply_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "entry_source_id_idx": { - "name": "entry_source_id_idx", - "columns": [ - "convo_message_source_id" - ], - "isUnique": false - }, - "entry_reply_id_idx": { - "name": "entry_reply_id_idx", - "columns": [ - "convo_message_reply_id" - ], - "isUnique": false - }, - "created_at_idx": { - "name": "created_at_idx", - "columns": [ - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_entry_replies_id": { - "name": "convo_entry_replies_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_entry_seen_timestamps": { - "name": "convo_entry_seen_timestamps", - "columns": { - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_entry_id": { - "name": "convo_entry_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "participant_id": { - "name": "participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "seen_at": { - "name": "seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "convo_entry_id_idx": { - "name": "convo_entry_id_idx", - "columns": [ - "convo_entry_id" - ], - "isUnique": false - }, - "participant_id_idx": { - "name": "participant_id_idx", - "columns": [ - "participant_id" - ], - "isUnique": false - }, - "seen_at_idx": { - "name": "seen_at_idx", - "columns": [ - "seen_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "id": { - "name": "id", - "columns": [ - "convo_entry_id", - "participant_id", - "org_member_id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_participant_team_members": { - "name": "convo_participant_team_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_participant_id": { - "name": "convo_participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "convo_participant_id_idx": { - "name": "convo_participant_id_idx", - "columns": [ - "convo_participant_id" - ], - "isUnique": false - }, - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_participant_team_members_id": { - "name": "convo_participant_team_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_participants": { - "name": "convo_participants", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('assigned','contributor','commenter','watcher','teamMember','guest')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'contributor'" - }, - "email_identity_id": { - "name": "email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notifications": { - "name": "notifications", - "type": "enum('active','muted','off')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "last_read_at": { - "name": "last_read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "active": { - "name": "active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "hidden": { - "name": "hidden", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "org_member_to_convo_idx": { - "name": "org_member_to_convo_idx", - "columns": [ - "convo_id", - "org_member_id" - ], - "isUnique": true - }, - "team_to_convo_idx": { - "name": "team_to_convo_idx", - "columns": [ - "convo_id", - "team_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_participants_id": { - "name": "convo_participants_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_seen_timestamps": { - "name": "convo_seen_timestamps", - "columns": { - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "participant_id": { - "name": "participant_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "seen_at": { - "name": "seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "seen_at_idx": { - "name": "seen_at_idx", - "columns": [ - "seen_at" - ], - "isUnique": false - }, - "participant_id_idx": { - "name": "participant_id_idx", - "columns": [ - "participant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "id": { - "name": "id", - "columns": [ - "convo_id", - "participant_id", - "org_member_id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_subjects": { - "name": "convo_subjects", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_subjects_id": { - "name": "convo_subjects_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_tags": { - "name": "convo_tags", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_to_space_id": { - "name": "convo_to_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "added_by_org_member_id": { - "name": "added_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "added_at": { - "name": "added_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "convo_to_spaces_id_idx": { - "name": "convo_to_spaces_id_idx", - "columns": [ - "convo_to_space_id" - ], - "isUnique": false - }, - "tag_idx": { - "name": "tag_idx", - "columns": [ - "tag_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_tags_id": { - "name": "convo_tags_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_to_spaces": { - "name": "convo_to_spaces", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_to_spaces_id": { - "name": "convo_to_spaces_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convo_workflows": { - "name": "convo_workflows", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_id": { - "name": "convo_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "convo_to_space_id": { - "name": "convo_to_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "workflow_id": { - "name": "workflow_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "by_org_member_id": { - "name": "by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "convo_id_idx": { - "name": "convo_id_idx", - "columns": [ - "convo_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "convo_to_spaces_id_idx": { - "name": "convo_to_spaces_id_idx", - "columns": [ - "convo_to_space_id" - ], - "isUnique": false - }, - "workflow_idx": { - "name": "workflow_idx", - "columns": [ - "workflow_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convo_workflows_id": { - "name": "convo_workflows_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "convos": { - "name": "convos", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_updated_at": { - "name": "last_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "created_at_idx": { - "name": "created_at_idx", - "columns": [ - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "convos_id": { - "name": "convos_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "domains": { - "name": "domains", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disabled": { - "name": "disabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "catch_all_address": { - "name": "catch_all_address", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "postal_host": { - "name": "postal_host", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "domain": { - "name": "domain", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "forwarding_address": { - "name": "forwarding_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "postal_id": { - "name": "postal_id", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "domain_status": { - "name": "domain_status", - "type": "enum('unverified','pending','active','disabled')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unverified'" - }, - "sending_mode": { - "name": "sending_mode", - "type": "enum('native','external','disabled')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "receiving_mode": { - "name": "receiving_mode", - "type": "enum('native','forwarding','disabled')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "dkim_key": { - "name": "dkim_key", - "type": "varchar(32)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dkim_value": { - "name": "dkim_value", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mx_dns_valid": { - "name": "mx_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "dkim_dns_valid": { - "name": "dkim_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "spf_dns_valid": { - "name": "spf_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "return_path_dns_valid": { - "name": "return_path_dns_valid", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_dns_check_at": { - "name": "last_dns_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "disabled_at": { - "name": "disabled_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "domain_name_idx": { - "name": "domain_name_idx", - "columns": [ - "domain" - ], - "isUnique": false - }, - "domain_org_idx": { - "name": "domain_org_idx", - "columns": [ - "domain", - "org_id" - ], - "isUnique": true - }, - "postal_id_idx": { - "name": "postal_id_idx", - "columns": [ - "postal_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "domains_id": { - "name": "domains_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identities": { - "name": "email_identities", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "domain_name": { - "name": "domain_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "domain_id": { - "name": "domain_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "routing_rule_id": { - "name": "routing_rule_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "send_name": { - "name": "send_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_catch_all": { - "name": "is_catch_all", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "personal_email_identity_id": { - "name": "personal_email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_credentials_id": { - "name": "external_credentials_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "forwarding_address": { - "name": "forwarding_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "domain_id_idx": { - "name": "domain_id_idx", - "columns": [ - "domain_name" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "email_idx": { - "name": "email_idx", - "columns": [ - "username", - "domain_name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identities_id": { - "name": "email_identities_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identities_authorized_org_members": { - "name": "email_identities_authorized_org_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "identity_id": { - "name": "identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "added_by": { - "name": "added_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "identity_id_idx": { - "name": "identity_id_idx", - "columns": [ - "identity_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "org_member_to_identity_idx": { - "name": "org_member_to_identity_idx", - "columns": [ - "identity_id", - "org_member_id" - ], - "isUnique": true - }, - "team_to_identity_idx": { - "name": "team_to_identity_idx", - "columns": [ - "identity_id", - "team_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identities_authorized_org_members_id": { - "name": "email_identities_authorized_org_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identities_personal": { - "name": "email_identities_personal", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_identity_id": { - "name": "email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "email_identity_id_idx": { - "name": "email_identity_id_idx", - "columns": [ - "email_identity_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identities_personal_id": { - "name": "email_identities_personal_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_identity_external": { - "name": "email_identity_external", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "nickname": { - "name": "nickname", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "hostname": { - "name": "hostname", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "port": { - "name": "port", - "type": "smallint", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_method": { - "name": "auth_method", - "type": "enum('plain','login')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "encryption": { - "name": "encryption", - "type": "enum('ssl','tls','starttls','none')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_identity_external_id": { - "name": "email_identity_external_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_routing_rule_assignees": { - "name": "email_routing_rule_assignees", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rule_destination_id": { - "name": "rule_destination_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "rule_destination_id_idx": { - "name": "rule_destination_id_idx", - "columns": [ - "rule_destination_id" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - }, - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_routing_rule_assignees_id": { - "name": "email_routing_rule_assignees_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_routing_rules": { - "name": "email_routing_rules", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_routing_rules_id": { - "name": "email_routing_rules_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "email_routing_rules_destinations": { - "name": "email_routing_rules_destinations", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rule_id": { - "name": "rule_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "rule_id_idx": { - "name": "rule_id_idx", - "columns": [ - "rule_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "email_routing_rules_destinations_id": { - "name": "email_routing_rules_destinations_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_billing": { - "name": "org_billing", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "stripe_customer_id": { - "name": "stripe_customer_id", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "stripe_subscription_id": { - "name": "stripe_subscription_id", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "plan": { - "name": "plan", - "type": "enum('starter','pro')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'starter'" - }, - "period": { - "name": "period", - "type": "enum('monthly','yearly')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'monthly'" - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "stripe_customer_id_idx": { - "name": "stripe_customer_id_idx", - "columns": [ - "stripe_customer_id" - ], - "isUnique": true - }, - "stripe_subscription_id_idx": { - "name": "stripe_subscription_id_idx", - "columns": [ - "stripe_subscription_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_billing_id": { - "name": "org_billing_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_invitations": { - "name": "org_invitations", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_org_member_id": { - "name": "invited_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invited_org_member_profile_id": { - "name": "invited_org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invite_token": { - "name": "invite_token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invited_at": { - "name": "invited_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": true - }, - "org_email_unique_idx": { - "name": "org_email_unique_idx", - "columns": [ - "org_id", - "email" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_invitations_id": { - "name": "org_invitations_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_member_profiles": { - "name": "org_member_profiles", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(30)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "handle": { - "name": "handle", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blurb": { - "name": "blurb", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_member_profiles_id": { - "name": "org_member_profiles_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_members": { - "name": "org_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "invited_by_org_member_id": { - "name": "invited_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "enum('invited','active','removed')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "personal_space_id": { - "name": "personal_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "org_member_profile_id": { - "name": "org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_email_identity_id": { - "name": "default_email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "added_at": { - "name": "added_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_account_idx": { - "name": "org_account_idx", - "columns": [ - "org_id", - "account_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_members_id": { - "name": "org_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_modules": { - "name": "org_modules", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "module": { - "name": "module", - "type": "enum('strip signatures','anonymous analytics')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_modified_by_org_member": { - "name": "last_modified_by_org_member", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_modified_at": { - "name": "last_modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "org_module_idx": { - "name": "org_module_idx", - "columns": [ - "org_id", - "module" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_modules_id": { - "name": "org_modules_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "org_postal_configs": { - "name": "org_postal_configs", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "host": { - "name": "host", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip_pools": { - "name": "ip_pools", - "type": "json", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_ip_pool": { - "name": "default_ip_pool", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "org_postal_configs_id": { - "name": "org_postal_configs_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "orgs": { - "name": "orgs", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "shortcode": { - "name": "shortcode", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "owner_id": { - "name": "owner_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "json", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "('{}')" - }, - "migrated_to_spaces": { - "name": "migrated_to_spaces", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "shortcode_idx": { - "name": "shortcode_idx", - "columns": [ - "shortcode" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "orgs_id": { - "name": "orgs_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "pending_attachments": { - "name": "pending_attachments", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_public_id": { - "name": "org_public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "varchar(256)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "pending_attachments_id": { - "name": "pending_attachments_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "postal_servers": { - "name": "postal_servers", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('email','transactional','marketing')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "api_key": { - "name": "api_key", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "smtp_key": { - "name": "smtp_key", - "type": "varchar(64)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_forwarding_address": { - "name": "root_forwarding_address", - "type": "varchar(128)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "postal_servers_id": { - "name": "postal_servers_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "sessions": { - "name": "sessions", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_id": { - "name": "account_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "account_public_id": { - "name": "account_public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "session_token": { - "name": "session_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "device": { - "name": "device", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "os": { - "name": "os", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "account_id_idx": { - "name": "account_id_idx", - "columns": [ - "account_id" - ], - "isUnique": false - }, - "session_token_idx": { - "name": "session_token_idx", - "columns": [ - "session_token" - ], - "isUnique": true - }, - "expires_at_idx": { - "name": "expires_at_idx", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "sessions_id": { - "name": "sessions_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "space_members": { - "name": "space_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'member'" - }, - "notifications": { - "name": "notifications", - "type": "enum('active','muted','off')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "added_by_org_member_id": { - "name": "added_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "added_at": { - "name": "added_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "can_create": { - "name": "can_create", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_read": { - "name": "can_read", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_comment": { - "name": "can_comment", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_reply": { - "name": "can_reply", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_delete": { - "name": "can_delete", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_change_workflow": { - "name": "can_change_workflow", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_set_workflow_to_closed": { - "name": "can_set_workflow_to_closed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_add_tags": { - "name": "can_add_tags", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_move_to_another_space": { - "name": "can_move_to_another_space", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_add_to_another_space": { - "name": "can_add_to_another_space", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_merge": { - "name": "can_merge", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "can_add_participants": { - "name": "can_add_participants", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - } - }, - "indexes": { - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "space_members_id": { - "name": "space_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "space_tags": { - "name": "space_tags", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "icon": { - "name": "icon", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tag-simple'" - }, - "created_by_org_member_id": { - "name": "created_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disabled": { - "name": "disabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - }, - "created_by_org_member_id_idx": { - "name": "created_by_org_member_id_idx", - "columns": [ - "created_by_org_member_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "space_tags_id": { - "name": "space_tags_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "space_workflows": { - "name": "space_workflows", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "space_id": { - "name": "space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('open','active','closed')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "order": { - "name": "order", - "type": "tinyint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "icon": { - "name": "icon", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'check'" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "disabled": { - "name": "disabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_by_org_member_id": { - "name": "created_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - }, - "space_id_idx": { - "name": "space_id_idx", - "columns": [ - "space_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "space_workflows_id": { - "name": "space_workflows_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "spaces": { - "name": "spaces", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_space_id": { - "name": "parent_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "shortcode": { - "name": "shortcode", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "enum('open','private')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "personal_space": { - "name": "personal_space", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "convo_prefix": { - "name": "convo_prefix", - "type": "varchar(8)", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inherit_parent_permissions": { - "name": "inherit_parent_permissions", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "icon": { - "name": "icon", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'squares-four'" - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_org_member_id": { - "name": "created_by_org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "shortcode_idx": { - "name": "shortcode_idx", - "columns": [ - "shortcode" - ], - "isUnique": false - }, - "shortcode_org_unique_idx": { - "name": "shortcode_org_unique_idx", - "columns": [ - "shortcode", - "org_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "spaces_id": { - "name": "spaces_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "team_members": { - "name": "team_members", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(29)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "team_id": { - "name": "team_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_id": { - "name": "org_member_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "org_member_profile_id": { - "name": "org_member_profile_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "added_by": { - "name": "added_by", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "enum('member','admin')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'member'" - }, - "notifications": { - "name": "notifications", - "type": "enum('active','muted','off')", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "team_id_idx": { - "name": "team_id_idx", - "columns": [ - "team_id" - ], - "isUnique": false - }, - "org_member_id_idx": { - "name": "org_member_id_idx", - "columns": [ - "org_member_id" - ], - "isUnique": false - }, - "org_member_to_team_idx": { - "name": "org_member_to_team_idx", - "columns": [ - "team_id", - "org_member_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "team_members_id": { - "name": "team_members_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - }, - "teams": { - "name": "teams", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": false, - "notNull": true, - "autoincrement": true - }, - "org_id": { - "name": "org_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "public_id": { - "name": "public_id", - "type": "char(28)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatar_timestamp": { - "name": "avatar_timestamp", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "enum('bronze','gold','brown','orange','tomato','red','ruby','crimson','pink','plum','purple','violet','iris','indigo','blue','cyan','teal','jade','green','grass')", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_email_identity_id": { - "name": "default_email_identity_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_space_id": { - "name": "default_space_id", - "type": "bigint unsigned", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "public_id_idx": { - "name": "public_id_idx", - "columns": [ - "public_id" - ], - "isUnique": true - }, - "org_id_idx": { - "name": "org_id_idx", - "columns": [ - "org_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "teams_id": { - "name": "teams_id", - "columns": [ - "id" - ] - } - }, - "uniqueConstraints": {} - } - }, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "tables": {}, - "indexes": {} - } -} \ No newline at end of file diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.json index 6d1e6ab2..b4017e6d 100644 --- a/packages/database/migrations/meta/_journal.json +++ b/packages/database/migrations/meta/_journal.json @@ -1,26 +1,12 @@ { "version": "7", - "dialect": "postgresql", + "dialect": "mysql", "entries": [ { "idx": 0, "version": "5", - "when": 1724158591283, - "tag": "0000_talented_wendell_vaughn", - "breakpoints": true - }, - { - "idx": 1, - "version": "5", - "when": 1724159018148, - "tag": "0001_confused_black_knight", - "breakpoints": true - }, - { - "idx": 2, - "version": "5", - "when": 1724179263014, - "tag": "0002_condemned_cyclops", + "when": 1724678051930, + "tag": "0000_cultured_cable", "breakpoints": true } ] diff --git a/packages/database/package.json b/packages/database/package.json index bb5970cf..82e590fb 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -9,21 +9,14 @@ }, "scripts": { "check": "tsc --noEmit", - "db:generate": "drizzle-kit generate --config=drizzle.config.ts", - "db:generate:branch": "dotenv -e ../../.env.test.local -- drizzle-kit generate --config=drizzle.config.ts", - "db:push": "drizzle-kit push --config=drizzle.config.ts && tsx postPush.ts", - "db:push:r": "drizzle-kit push --config=drizzle.config.ts && tsx postPush.ts", - "db:check": "drizzle-kit check --config=drizzle.config.ts", - "db:clean": "tsx dbClean.ts", - "db:up": "drizzle-kit up --config=drizzle.config.ts", - "db:drop": "drizzle-kit drop --config=drizzle.config.ts", - "db:drop:r": "drizzle-kit drop --config=drizzle.config.ts", - "db:studio": "pnpm drizzle-kit studio --port 3333 --config=drizzle.config.ts", - "db:studio:r": "drizzle-kit studio --port 3333 --config=drizzle.config.ts", - "db:seed:r": "tsx dbSeed.ts", + "db:push": "drizzle-kit push", "db:migrate": "tsx migrate.ts", - "db:migrate:branch": "dotenv -e ../../.env.test.local -- tsx migrate.ts", - "db:clean:r": "infisical run --env=remote -- tsx dbClean.ts" + "db:studio": "drizzle-kit studio --port 3333", + "db:check": "drizzle-kit check", + "db:generate": "drizzle-kit generate", + "db:clean": "tsx dbClean.ts", + "db:up": "drizzle-kit up", + "db:drop": "drizzle-kit drop" }, "dependencies": { "@planetscale/database": "^1.19.0", diff --git a/packages/database/postPush.ts b/packages/database/postPush.ts deleted file mode 100644 index 3c2c0a5f..00000000 --- a/packages/database/postPush.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { sql } from './orm'; -import { db } from '.'; - -console.info('🔥 Running post push script to fix drizzle issues'); -// eslint-disable-next-line no-console -console.time('🪩 Post push script complete'); -await db.execute( - sql.raw(`ALTER TABLE convo_entries DROP COLUMN email_message_id;`) -); -await db.execute( - sql.raw( - `ALTER TABLE convo_entries ADD COLUMN email_message_id varchar(255) AS (JSON_UNQUOTE(metadata-> '$.email.messageId')) STORED;` - ) -); -// eslint-disable-next-line no-console -console.timeEnd('🪩 Post push script complete'); diff --git a/packages/database/schema.ts b/packages/database/schema.ts index 8f240c32..30661973 100644 --- a/packages/database/schema.ts +++ b/packages/database/schema.ts @@ -16,7 +16,6 @@ import { varchar, text, mediumtext, - customType, longtext } from 'drizzle-orm/mysql-core'; import { @@ -26,25 +25,15 @@ import { } from '@u22n/utils/spaces'; import { typeIdDataType as publicId } from '@u22n/utils/typeid'; import { uiColors } from '@u22n/utils/colors'; -import { relations } from 'drizzle-orm'; +import { relations, sql } from 'drizzle-orm'; -// import { stripeBillingPeriods, stripePlanNames } from '../../ee/apps/billing'; const stripeBillingPeriods = ['monthly', 'yearly'] as const; const stripePlanNames = ['starter', 'pro'] as const; //TODO: add support for Check constraints when implemented in drizzle-orm & drizzle-kit -// These custom types support incompatibilities with drizzle-orm or types that must remain in sync across db - -// Foreign Key type as drizzle does not support unsigned bigint -const foreignKey = customType<{ data: number }>({ - dataType() { - return 'bigint unsigned'; - }, - fromDriver(value: unknown): number { - return Number(value); - } -}); +const foreignKey = (name: string) => + bigint(name, { unsigned: true, mode: 'number' }); //******************* */ //* Account tables @@ -1542,7 +1531,7 @@ export const convoParticipants = mysqlTable( publicIdIndex: uniqueIndex('public_id_idx').on(table.publicId), orgMemberIdIndex: index('org_member_id_idx').on(table.orgMemberId), convoIdIndex: index('convo_id_idx').on(table.convoId), - orgMemberToConvoIndex: uniqueIndex('org_member_to_convo_idx').on( + orgMemberToConvoIndex: index('org_member_to_convo_idx').on( table.convoId, table.orgMemberId ), @@ -1731,12 +1720,6 @@ export type ConvoEntryMetadata = { email?: ConvoEntryMetadataEmail; }; -const messageIdCustomType = customType<{ data: string }>({ - dataType() { - //return "varchar(255) AS (JSON_UNQUOTE(metadata-> '$.email.messageId')) STORED"; - return 'varchar(255)'; - } -}); export const convoEntries = mysqlTable( 'convo_entries', { @@ -1752,7 +1735,11 @@ export const convoEntries = mysqlTable( bodyPlainText: longtext('body_plain_text').notNull(), bodyCleanedHtml: longtext('body_cleaned_html'), metadata: json('metadata').$type().default({}), - emailMessageId: messageIdCustomType('email_message_id'), + emailMessageId: varchar('email_message_id', { + length: 255 + }).generatedAlwaysAs(sql`JSON_UNQUOTE(metadata-> '$.email.messageId')`, { + mode: 'stored' + }), visibility: mysqlEnum('visibility', [ 'private', 'internal_participants',