/// SQL schema for the downloaded_series table class DownloadedSeriesTable { DownloadedSeriesTable._(); static const String tableName = 'downloaded_series'; /// SQL statement to create the downloaded_series table static const String createTable = ''' CREATE TABLE $tableName ( id TEXT PRIMARY KEY, server_id TEXT NOT NULL, series_feed_url TEXT NOT NULL, title TEXT NOT NULL, cover_url TEXT, cover_path TEXT, thumbnail_url TEXT, thumbnail_path TEXT, status TEXT NOT NULL DEFAULT 'pending', total_chapters INTEGER NOT NULL DEFAULT 0, downloaded_chapters_count INTEGER NOT NULL DEFAULT 0, downloaded_at INTEGER, updated_at INTEGER NOT NULL, FOREIGN KEY (server_id) REFERENCES servers(id) ON DELETE CASCADE, UNIQUE(server_id, series_feed_url) ) '''; /// SQL statement to drop the downloaded_series table static const String dropTable = 'DROP TABLE IF EXISTS $tableName'; /// Create index on server_id for faster lookups static const String createServerIndex = ''' CREATE INDEX idx_downloaded_series_server_id ON $tableName(server_id) '''; /// Create index on status for filtering static const String createStatusIndex = ''' CREATE INDEX idx_downloaded_series_status ON $tableName(status) '''; }