feat(migrations): Harden task audit tracking and optimize article templates
- 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.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE prompt_rule_groups (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
tenant_id BIGINT NOT NULL REFERENCES tenants(id),
|
||||
name VARCHAR(100) NOT NULL,
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX idx_prompt_rule_group_tenant ON prompt_rule_groups(tenant_id, sort_order);
|
||||
|
||||
CREATE TABLE prompt_rules (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
tenant_id BIGINT NOT NULL REFERENCES tenants(id),
|
||||
group_id BIGINT REFERENCES prompt_rule_groups(id),
|
||||
name VARCHAR(100) NOT NULL,
|
||||
prompt_content TEXT NOT NULL,
|
||||
scene VARCHAR(50),
|
||||
default_tone VARCHAR(30),
|
||||
default_word_count INT,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'enabled',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
CREATE INDEX idx_prompt_rule_tenant ON prompt_rules(tenant_id, created_at DESC);
|
||||
CREATE INDEX idx_prompt_rule_tenant_status ON prompt_rules(tenant_id, status) WHERE deleted_at IS NULL;
|
||||
CREATE INDEX idx_prompt_rule_group ON prompt_rules(group_id) WHERE deleted_at IS NULL;
|
||||
Reference in New Issue
Block a user