From 00b4934bf62ab86b72a77b7cb88d7af6667b01c1 Mon Sep 17 00:00:00 2001 From: gilesb Date: Mon, 12 Jan 2026 08:19:40 +0000 Subject: [PATCH] Remove database migration blocks Clean schema without migration code for fresh deployments. Co-Authored-By: Claude Opus 4.5 --- database.py | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/database.py b/database.py index dc20af9..35a11b9 100644 --- a/database.py +++ b/database.py @@ -43,12 +43,6 @@ CREATE TABLE IF NOT EXISTS item_types ( UNIQUE(cid, actor_id, type, path) ); --- Add columns if they don't exist (for existing databases) -DO $$ BEGIN - ALTER TABLE item_types ADD COLUMN IF NOT EXISTS filename VARCHAR(255); - ALTER TABLE item_types ADD COLUMN IF NOT EXISTS metadata JSONB DEFAULT '{}'; -EXCEPTION WHEN others THEN NULL; -END $$; -- Pin reasons: one-to-many from item_types CREATE TABLE IF NOT EXISTS pin_reasons ( @@ -72,30 +66,6 @@ CREATE TABLE IF NOT EXISTS l2_shares ( UNIQUE(cid, actor_id, l2_server, content_type) ); --- Add activity_id column if it doesn't exist (for existing databases) -DO $$ BEGIN - ALTER TABLE l2_shares ADD COLUMN IF NOT EXISTS activity_id VARCHAR(128); -EXCEPTION WHEN others THEN NULL; -END $$; - --- Migration: rename content_hash to cid (for existing databases) -DO $$ BEGIN - IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'cache_items' AND column_name = 'content_hash') THEN - ALTER TABLE cache_items RENAME COLUMN content_hash TO cid; - END IF; - IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'item_types' AND column_name = 'content_hash') THEN - ALTER TABLE item_types RENAME COLUMN content_hash TO cid; - END IF; - IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'l2_shares' AND column_name = 'content_hash') THEN - ALTER TABLE l2_shares RENAME COLUMN content_hash TO cid; - END IF; - IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'storage_pins' AND column_name = 'content_hash') THEN - ALTER TABLE storage_pins RENAME COLUMN content_hash TO cid; - END IF; - IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'run_cache' AND column_name = 'output_hash') THEN - ALTER TABLE run_cache RENAME COLUMN output_hash TO output_cid; - END IF; -END $$; -- Run cache: maps content-addressable run_id to output -- run_id is a hash of (sorted inputs + recipe), making runs deterministic