summaryrefslogblamecommitdiff
path: root/makima/migrations/20260204100000_chain_default_pending.sql
blob: 28035626fa971e9b725d7c430abf215aecd07a42 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
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);