fix: add updated_at columns to ai_proactive migration
- ai_proactive_suggestions: add updated_at TIMESTAMPTZ - ai_proactive_context_log: add updated_at TIMESTAMPTZ TenantMixin inherits TimestampMixin which expects both created_at and updated_at. Missing updated_at caused 500 errors on /ai-proactive/context POST.
This commit is contained in:
@@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS ai_proactive_suggestions (
|
|||||||
is_acted_upon BOOLEAN NOT NULL DEFAULT FALSE,
|
is_acted_upon BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
context_snapshot JSONB NOT NULL DEFAULT '{}',
|
context_snapshot JSONB NOT NULL DEFAULT '{}',
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
expires_at TIMESTAMPTZ,
|
expires_at TIMESTAMPTZ,
|
||||||
deleted_at TIMESTAMPTZ
|
deleted_at TIMESTAMPTZ
|
||||||
);
|
);
|
||||||
@@ -32,6 +33,7 @@ CREATE TABLE IF NOT EXISTS ai_proactive_context_log (
|
|||||||
entity_id UUID,
|
entity_id UUID,
|
||||||
entity_data JSONB NOT NULL DEFAULT '{}',
|
entity_data JSONB NOT NULL DEFAULT '{}',
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
deleted_at TIMESTAMPTZ
|
deleted_at TIMESTAMPTZ
|
||||||
);
|
);
|
||||||
CREATE INDEX IF NOT EXISTS ix_context_log_user_time ON ai_proactive_context_log (tenant_id, user_id, created_at DESC);
|
CREATE INDEX IF NOT EXISTS ix_context_log_user_time ON ai_proactive_context_log (tenant_id, user_id, created_at DESC);
|
||||||
|
|||||||
Reference in New Issue
Block a user