summaryrefslogtreecommitdiff
path: root/makima/migrations/20260204100000_chain_default_pending.sql
diff options
context:
space:
mode:
Diffstat (limited to 'makima/migrations/20260204100000_chain_default_pending.sql')
-rw-r--r--makima/migrations/20260204100000_chain_default_pending.sql12
1 files changed, 12 insertions, 0 deletions
diff --git a/makima/migrations/20260204100000_chain_default_pending.sql b/makima/migrations/20260204100000_chain_default_pending.sql
new file mode 100644
index 0000000..2803562
--- /dev/null
+++ b/makima/migrations/20260204100000_chain_default_pending.sql
@@ -0,0 +1,12 @@
+-- Fix chain default status to 'pending' instead of 'active'
+-- Chains should start as pending until explicitly started
+
+-- Change default for new chains
+ALTER TABLE chains ALTER COLUMN status SET DEFAULT 'pending';
+
+-- Update any chains that have no contracts and are 'active' to 'pending'
+-- (These were likely created but never properly started)
+UPDATE chains
+SET status = 'pending'
+WHERE status = 'active'
+ AND id NOT IN (SELECT DISTINCT chain_id FROM chain_contracts WHERE chain_id IS NOT NULL);