source_fingerprint pins the database state the plan was generated against, not the plan’s SQL. You can freely edit the steps; pgschema apply still detects if the database has drifted since planning.
Example: add a NOT NULL column with backfill
Desired state inschema.sql:
1
Generate Plan
2
Edit Plan
Rewrite the step to add the column as nullable first, insert a backfill step, then enforce the constraint. Only the Steps within a group execute in a single transaction, so the backfill and constraint either all succeed or roll back together.
sql field is required for hand-added steps:3
Apply Plan
schema.sql, so subsequent plans are empty — the data migration naturally runs only once.DROP + ADD into ALTER TABLE ... RENAME, or seeding lookup-table rows alongside a new table.
