From 0639cf0f0e63c52f87a46c25946c143d72e67e53 Mon Sep 17 00:00:00 2001 From: blankie Date: Fri, 3 Jul 2026 02:02:46 +0000 Subject: [PATCH] chore: remove pre-release schema migrations --- src/tinyweb/db.py | 53 ----------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/src/tinyweb/db.py b/src/tinyweb/db.py index c8138dc..664119d 100644 --- a/src/tinyweb/db.py +++ b/src/tinyweb/db.py @@ -248,41 +248,6 @@ def init_db(): " added_at TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M:%S','now'))" ")" ) - # Migrate old subscriptions table if needed - cols = [row[1] for row in db.execute("PRAGMA table_info(subscriptions)").fetchall()] - if "url" in cols and "dest_hash" not in cols: - db.execute("ALTER TABLE subscriptions RENAME COLUMN url TO dest_hash") - db.commit() - - # Migrate remote_pages: add tags column if missing - rp_cols = [row[1] for row in db.execute("PRAGMA table_info(remote_pages)").fetchall()] - if "tags" not in rp_cols: - db.execute("ALTER TABLE remote_pages ADD COLUMN tags TEXT DEFAULT ''") - db.commit() - - # Migrate pages: add last_modified column if missing - page_cols = [row[1] for row in db.execute("PRAGMA table_info(pages)").fetchall()] - if "last_modified" not in page_cols: - db.execute("ALTER TABLE pages ADD COLUMN last_modified TEXT DEFAULT ''") - db.execute("UPDATE pages SET last_modified = strftime('%Y-%m-%dT%H:%M:%S','now') WHERE last_modified = ''") - db.commit() - - # Migrate pages: add summary column if missing - if "summary" not in page_cols: - db.execute("ALTER TABLE pages ADD COLUMN summary TEXT DEFAULT ''") - db.commit() - - # Migrate pages: add reticulum_dest column if missing - if "reticulum_dest" not in page_cols: - db.execute("ALTER TABLE pages ADD COLUMN reticulum_dest TEXT DEFAULT ''") - db.commit() - - # Migrate subscriptions: add forum_enabled column - sub_cols = [row[1] for row in db.execute("PRAGMA table_info(subscriptions)").fetchall()] - if "forum_enabled" not in sub_cols: - db.execute("ALTER TABLE subscriptions ADD COLUMN forum_enabled INTEGER DEFAULT 0") - db.commit() - # Chunks table for semantic search embeddings db.execute( "CREATE TABLE IF NOT EXISTS chunks (" @@ -304,24 +269,6 @@ def init_db(): db.execute("CREATE INDEX IF NOT EXISTS idx_page_tags_page ON page_tags(page_id)") db.execute("CREATE INDEX IF NOT EXISTS idx_page_tags_tag ON page_tags(tag_id)") - # Migrate custom_template: replace hardcoded forum link with {{forum_link}} placeholder - cur = db.execute("SELECT value FROM settings WHERE key='custom_template'") - row = cur.fetchone() - if row: - updated = row[0].replace('forum', "{{forum_link}}") - if updated != row[0]: - db.execute("UPDATE settings SET value=? WHERE key='custom_template'", (updated,)) - db.commit() - - # Migrate custom_template: replace hardcoded site name with {{site_name}} placeholder - cur = db.execute("SELECT value FROM settings WHERE key='custom_template'") - row = cur.fetchone() - if row and '{{site_name}}' not in row[0]: - updated = row[0].replace('href="/">tinyweb', 'href="/">{{site_name}}') - if updated != row[0]: - db.execute("UPDATE settings SET value=? WHERE key='custom_template'", (updated,)) - db.commit() - db.execute("PRAGMA journal_mode=WAL") db.execute("PRAGMA synchronous=NORMAL") db.execute("PRAGMA cache_size=-64000")