b31d8d0096
- Added migration to harden task audit tracking by modifying audit_logs and related tables. - Introduced operator_id to several tables for better tracking of actions. - Updated article_templates with new prompt templates for various article types, enhancing content generation. - Created prompt_rules and schedule_tasks tables to manage content generation rules and scheduling. - Added foreign key constraints to articles for better data integrity.
20 lines
761 B
SQL
20 lines
761 B
SQL
CREATE TABLE template_assist_tasks (
|
|
id VARCHAR(64) PRIMARY KEY,
|
|
tenant_id BIGINT NOT NULL REFERENCES tenants(id),
|
|
template_id BIGINT NOT NULL REFERENCES article_templates(id),
|
|
status VARCHAR(20) NOT NULL DEFAULT 'queued',
|
|
request_json JSONB NOT NULL DEFAULT '{}'::jsonb,
|
|
result_json JSONB,
|
|
error_message TEXT,
|
|
started_at TIMESTAMPTZ,
|
|
completed_at TIMESTAMPTZ,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX idx_template_assist_tasks_tenant_created
|
|
ON template_assist_tasks(tenant_id, created_at DESC);
|
|
|
|
CREATE INDEX idx_template_assist_tasks_status_created
|
|
ON template_assist_tasks(status, created_at DESC);
|