Skip to content

Commit dc6977b

Browse files
markmnlclaude
andauthored
Document dd.sql idempotency: migration is re-running the whole script (#35)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 9b43f27 commit dc6977b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

dd.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
--
66
-- fmsg-webapi assumes fmsgd is the fmsg host implementation and uses the same
77
-- PostgreSQL database.
8+
--
9+
-- This script is IDEMPOTENT: every statement is safe to re-run (CREATE ... IF
10+
-- NOT EXISTS, ALTER TABLE ... ADD COLUMN IF NOT EXISTS, DROP CONSTRAINT IF
11+
-- EXISTS, guarded DO blocks). Migrating an existing database is therefore
12+
-- just re-running the whole script, e.g.:
13+
--
14+
-- psql -d fmsgd -v ON_ERROR_STOP=1 -f dd.sql
15+
--
16+
-- Keep it that way: add new objects and columns only with idempotent
17+
-- statements.
818

919
CREATE TABLE IF NOT EXISTS fmsg_api_sub_account (
1020
owner_addr varchar(255) NOT NULL,

0 commit comments

Comments
 (0)