-- ArticleCollection插件数据库初始化脚本

-- 创建合集表
CREATE TABLE IF NOT EXISTS plugin_collection (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    description TEXT,
    cover TEXT,
    related_articles TEXT,
    sort_order TEXT DEFAULT 'created_desc',
    is_active INTEGER DEFAULT 1,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

-- 创建更新时间触发器
CREATE TRIGGER IF NOT EXISTS update_collection_time
AFTER UPDATE ON plugin_collection
BEGIN
    UPDATE plugin_collection SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
END;