feat(reader): autonomous Wikipedia import and reading with media, tables and settings
This commit is contained in:
1 parent
52db766b23
commit
dee9b8d10b
9 files changed
+1659
-24
No files matched your search
@@ -79,12 +79,18 @@ def _migrate(conn: sqlite3.Connection):
|
||||
current_chapter INTEGER DEFAULT 0,
|
||||
current_position REAL DEFAULT 0,
|
||||
total_words INTEGER DEFAULT 0,
|
||||
cover_url TEXT DEFAULT '',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
);
|
||||
""")
|
||||
|
||||
# Safe migration: ensure cover_url column exists in books
|
||||
books_cols = {row[1] for row in conn.execute("PRAGMA table_info(books)").fetchall()}
|
||||
if "cover_url" not in books_cols:
|
||||
conn.execute("ALTER TABLE books ADD COLUMN cover_url TEXT DEFAULT ''")
|
||||
|
||||
# --- Deduplicate vocabulary_cards (case-insensitive) and enforce UNIQUE index ---
|
||||
dup_rows = conn.execute("""
|
||||
SELECT user_id, lower(trim(term)) as clean_term, COUNT(*) as cnt
|
||||
|
||||
Reference in new issue
Block a user