How to Keep Reference Data & Feature Flags in Sync
Seed tables, lookup data and feature flags - kept in step without hand-written INSERT scripts.
npm install -g @akal/supaforge. A hosted dashboard is on the way - to hear when it opens.The Problem with Reference Data
Most applications depend on rows nobody's users create: lookup tables (countries, currencies, roles), feature flags, pricing plans, configuration. They're seeded once in development and then recreated by hand in staging and production.
When someone flips a flag in staging, adds a role or changes a plan, the row rarely reaches production through a formal process - and the bug it causes can't be reproduced anywhere else.
What SupaForge Does
The data check compares the tables you list, row by row, and writes the SQL that reconciles the target: INSERT for missing rows, UPDATE for changed ones and DELETE for rows only the target has.
Each table is fingerprinted on both sides first, so unchanged tables cost almost nothing; only the ones that differ are diffed, by the DBDiff engine.
Step 1 - Choose the Tables
npm install -g @akal/supaforge{
"environments": {
"staging": { "dbUrl": "$STAGING_DATABASE_URL" },
"production": { "dbUrl": "$PRODUCTION_DATABASE_URL" }
},
"source": "staging",
"target": "production",
"checks": {
"data": {
"tables": ["roles", "countries", "feature_flags", "pricing_plans"]
}
}
}Only the tables in checks.data.tables are compared, so user data is never read or touched. Give them a primary key, so a changed row can be told apart from a new one. Snapshots include the same tables, so a restore brings the rows back too.
Step 2 - Compare
supaforge diff --check=data --detailEach table with differences comes with the statements that fix it:
- Missing rows - in the source, not the target. Fixed with INSERT.
- Changed rows - same primary key, different values. Fixed with UPDATE.
- Extra rows - in the target only. Fixed with DELETE, which waits for
--allow-destructive.
Step 3 - Sync
supaforge diff --check=data --apply --dry-runsupaforge diff --check=data --applyBest Practices
- List reference tables explicitly. Only tables whose content the team controls belong in
checks.data.tables. - Look at extra rows before deleting them. A production-only flag may be deliberate.
- Commit the config. The list of reference tables then lives next to your schema and changes with it.
- Run schema and data together. A new column on a reference table shows up in both, and the fixes run in the right order.
Summary
Reference data drift is one of the commonest causes of "works in staging". SupaForge compares the tables you choose, row by row, and writes the exact SQL to bring the target in line - no more hand-written seed scripts.
Ready to try SupaForge?
Install the CLI and run your first diff in a minute. Nothing is changed until you add --apply.
npm install -g @akal/supaforge