mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(migrations): sync email oauth tokens with init schema
This commit is contained in:
@@ -15,6 +15,10 @@ DROP TABLE IF EXISTS bot_preauth_keys;
|
|||||||
DROP TABLE IF EXISTS bot_channel_configs;
|
DROP TABLE IF EXISTS bot_channel_configs;
|
||||||
DROP TABLE IF EXISTS mcp_connections;
|
DROP TABLE IF EXISTS mcp_connections;
|
||||||
DROP TABLE IF EXISTS bot_members;
|
DROP TABLE IF EXISTS bot_members;
|
||||||
|
DROP TABLE IF EXISTS email_outbox;
|
||||||
|
DROP TABLE IF EXISTS bot_email_bindings;
|
||||||
|
DROP TABLE IF EXISTS email_oauth_tokens;
|
||||||
|
DROP TABLE IF EXISTS email_providers;
|
||||||
DROP TABLE IF EXISTS bots;
|
DROP TABLE IF EXISTS bots;
|
||||||
DROP TABLE IF EXISTS memory_providers;
|
DROP TABLE IF EXISTS memory_providers;
|
||||||
DROP TABLE IF EXISTS model_variants;
|
DROP TABLE IF EXISTS model_variants;
|
||||||
|
|||||||
@@ -492,6 +492,22 @@ CREATE TABLE IF NOT EXISTS email_providers (
|
|||||||
CONSTRAINT email_providers_name_unique UNIQUE (name)
|
CONSTRAINT email_providers_name_unique UNIQUE (name)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- email_oauth_tokens: stored OAuth2 tokens for Gmail email providers
|
||||||
|
CREATE TABLE IF NOT EXISTS email_oauth_tokens (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
email_provider_id UUID NOT NULL UNIQUE REFERENCES email_providers(id) ON DELETE CASCADE,
|
||||||
|
email_address TEXT NOT NULL DEFAULT '',
|
||||||
|
access_token TEXT NOT NULL DEFAULT '',
|
||||||
|
refresh_token TEXT NOT NULL DEFAULT '',
|
||||||
|
expires_at TIMESTAMPTZ,
|
||||||
|
scope TEXT NOT NULL DEFAULT '',
|
||||||
|
state TEXT NOT NULL DEFAULT '',
|
||||||
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_email_oauth_tokens_state ON email_oauth_tokens(state) WHERE state != '';
|
||||||
|
|
||||||
-- bot_email_bindings: per-bot email provider binding with read/write/delete permissions
|
-- bot_email_bindings: per-bot email provider binding with read/write/delete permissions
|
||||||
CREATE TABLE IF NOT EXISTS bot_email_bindings (
|
CREATE TABLE IF NOT EXISTS bot_email_bindings (
|
||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
|||||||
Reference in New Issue
Block a user