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:
2026-04-02 00:31:28 +08:00
parent de30497f59
commit b31d8d0096
101 changed files with 16671 additions and 721 deletions
@@ -94,7 +94,7 @@ func (q *Queries) GetQuotaSummary(ctx context.Context, tenantID int64) (int32, e
const getRecentArticles = `-- name: GetRecentArticles :many
SELECT a.id, a.generate_status, a.publish_status, a.source_type, a.created_at,
av.title, av.word_count, av.source_label,
av.title, av.markdown_content, av.word_count, av.source_label,
t.template_name
FROM articles a
LEFT JOIN article_versions av ON av.id = a.current_version_id
@@ -105,15 +105,16 @@ LIMIT 10
`
type GetRecentArticlesRow struct {
ID int64 `json:"id"`
GenerateStatus string `json:"generate_status"`
PublishStatus string `json:"publish_status"`
SourceType string `json:"source_type"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
Title pgtype.Text `json:"title"`
WordCount pgtype.Int4 `json:"word_count"`
SourceLabel pgtype.Text `json:"source_label"`
TemplateName pgtype.Text `json:"template_name"`
ID int64 `json:"id"`
GenerateStatus string `json:"generate_status"`
PublishStatus string `json:"publish_status"`
SourceType string `json:"source_type"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
Title pgtype.Text `json:"title"`
MarkdownContent pgtype.Text `json:"markdown_content"`
WordCount pgtype.Int4 `json:"word_count"`
SourceLabel pgtype.Text `json:"source_label"`
TemplateName pgtype.Text `json:"template_name"`
}
func (q *Queries) GetRecentArticles(ctx context.Context, tenantID int64) ([]GetRecentArticlesRow, error) {
@@ -132,6 +133,7 @@ func (q *Queries) GetRecentArticles(ctx context.Context, tenantID int64) ([]GetR
&i.SourceType,
&i.CreatedAt,
&i.Title,
&i.MarkdownContent,
&i.WordCount,
&i.SourceLabel,
&i.TemplateName,