[update] added migration scripts for migrating news
data to articles
, geographic and category tagging, and default sharing templates
This commit is contained in:
27
backend-rust/migrations/003_create_articles_table.up.sql
Normal file
27
backend-rust/migrations/003_create_articles_table.up.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Create enhanced articles table to replace news table structure
|
||||
CREATE TABLE IF NOT EXISTS articles
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title TEXT NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
source_type TEXT NOT NULL DEFAULT 'rss', -- 'rss', 'manual'
|
||||
rss_content TEXT, -- RSS description/excerpt
|
||||
full_content TEXT, -- Scraped full content
|
||||
summary TEXT, -- AI-generated summary
|
||||
processing_status TEXT NOT NULL DEFAULT 'pending', -- 'pending', 'processing', 'completed', 'failed'
|
||||
published_at TIMESTAMP NOT NULL,
|
||||
added_at TIMESTAMP NOT NULL DEFAULT (datetime('now')),
|
||||
read_at TIMESTAMP,
|
||||
read_count INTEGER NOT NULL DEFAULT 0,
|
||||
reading_time INTEGER, -- in seconds
|
||||
ai_enabled BOOLEAN NOT NULL DEFAULT 1,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
-- Create indexes for performance
|
||||
CREATE INDEX IF NOT EXISTS idx_articles_published_at ON articles (published_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_articles_added_at ON articles (added_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_articles_processing_status ON articles (processing_status);
|
||||
CREATE INDEX IF NOT EXISTS idx_articles_source_type ON articles (source_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_articles_read_at ON articles (read_at);
|
Reference in New Issue
Block a user