fix: add deleted_at columns to AI Assistant migration SQL
This commit is contained in:
@@ -11,7 +11,8 @@ CREATE TABLE IF NOT EXISTS ai_providers (
|
||||
config JSONB NOT NULL DEFAULT '{}',
|
||||
tenant_id UUID NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_providers_tenant ON ai_providers(tenant_id);
|
||||
|
||||
@@ -27,7 +28,8 @@ CREATE TABLE IF NOT EXISTS ai_models (
|
||||
config JSONB NOT NULL DEFAULT '{}',
|
||||
tenant_id UUID NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_models_provider ON ai_models(provider_id);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_models_tenant ON ai_models(tenant_id);
|
||||
@@ -45,7 +47,8 @@ CREATE TABLE IF NOT EXISTS ai_presets (
|
||||
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
tenant_id UUID NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_presets_tenant ON ai_presets(tenant_id);
|
||||
|
||||
@@ -61,7 +64,8 @@ CREATE TABLE IF NOT EXISTS ai_agents (
|
||||
config JSONB NOT NULL DEFAULT '{}',
|
||||
tenant_id UUID NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_agents_tenant ON ai_agents(tenant_id);
|
||||
|
||||
@@ -74,7 +78,8 @@ CREATE TABLE IF NOT EXISTS ai_chat_sessions (
|
||||
is_sidebar BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
tenant_id UUID NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_sessions_user ON ai_chat_sessions(user_id);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_sessions_tenant ON ai_chat_sessions(tenant_id);
|
||||
@@ -90,7 +95,8 @@ CREATE TABLE IF NOT EXISTS ai_chat_messages (
|
||||
model_used VARCHAR(200) NOT NULL DEFAULT '',
|
||||
tenant_id UUID NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_messages_session ON ai_chat_messages(session_id);
|
||||
CREATE INDEX IF NOT EXISTS ix_ai_messages_tenant ON ai_chat_messages(tenant_id);
|
||||
|
||||
Reference in New Issue
Block a user