Table "public.gmail_accounts" Column | Type | Collation | Nullable | Default -----------------+--------------------------+-----------+----------+-------------------------------------------- id | integer | | not null | nextval('gmail_accounts_id_seq'::regclass) user_id | integer | | not null | email | character varying(320) | | not null | display_name | character varying(200) | | | status | character varying(30) | | | sending_method | character varying(20) | | | auth_provider | character varying(60) | | | google_user_id | character varying(120) | | | daily_limit | integer | | | campaign_limit | integer | | | sends_today | integer | | | last_send_date | timestamp with time zone | | | cooldown_until | timestamp with time zone | | | last_success_at | timestamp with time zone | | | last_error | text | | | error_count | integer | | | token_expiry | timestamp with time zone | | | oauth_config_id | integer | | | is_active | boolean | | not null | revoked_by_user | boolean | | | revoked_at | timestamp with time zone | | | created_at | timestamp with time zone | | not null | updated_at | timestamp with time zone | | not null | Indexes: "gmail_accounts_pkey" PRIMARY KEY, btree (id) "ix_gmail_accounts_created_at" btree (created_at) "ix_gmail_accounts_user_id" btree (user_id) "ix_gmail_status" btree (status) "uq_gmail_account_user_email" UNIQUE CONSTRAINT, btree (user_id, email) Foreign-key constraints: "gmail_accounts_oauth_config_id_fkey" FOREIGN KEY (oauth_config_id) REFERENCES oauth_client_configs(id) ON DELETE SET NULL "gmail_accounts_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE Referenced by: TABLE "campaign_recipients" CONSTRAINT "campaign_recipients_assigned_account_id_fkey" FOREIGN KEY (assigned_account_id) REFERENCES gmail_accounts(id) ON DELETE SET NULL TABLE "email_events" CONSTRAINT "email_events_gmail_account_id_fkey" FOREIGN KEY (gmail_account_id) REFERENCES gmail_accounts(id) ON DELETE SET NULL TABLE "oauth_tokens" CONSTRAINT "oauth_tokens_account_id_fkey" FOREIGN KEY (account_id) REFERENCES gmail_accounts(id) ON DELETE CASCADE TABLE "send_attempts" CONSTRAINT "send_attempts_gmail_account_id_fkey" FOREIGN KEY (gmail_account_id) REFERENCES gmail_accounts(id) ON DELETE SET NULL