Skip to content

chore(migrations): seed codes_enabled setting - #365

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1794058694-seed-codes-enabled
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1794058694-seed-codes-enabled

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #363. Seeds the codes_enabled setting row like the other boolean settings (000029_seed_points_enabled, 000053_seed_decisions_released), so the closed default is stored in the DB rather than only implied by GetCodesEnabled's fallback.

-- 000125_seed_codes_enabled.up.sql
INSERT INTO settings (key, value) VALUES ('codes_enabled', 'false'::jsonb)
ON CONFLICT (key) DO NOTHING;
-- down: DELETE FROM settings WHERE key = 'codes_enabled';

ON CONFLICT DO NOTHING means that if a super admin already opened codes after #363 deployed, the migration leaves that row untouched. No code changes.

Testing

  • ./scripts/check-migrations.sh: 125 contiguous pairs.
  • Locally ran up, then down 1, then up: an existing true row survived the first up, down removed it, and the second up seeded false.

Link to Devin session: https://app.devin.ai/sessions/d8e19df93b774e33b38363ae66efd630
Open in Devin Desktop: https://app.devin.ai/desktop/session/d8e19df93b774e33b38363ae66efd630?variant=devin
Requested by: @balebbae

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

This PR changes database migrations

  • cmd/migrate/migrations/000125_seed_codes_enabled.up.sql (added)

Merging deploys this code to staging, and the next release deploys it to prod. Neither deploy runs migrations.

  • Additive (new table, nullable column, new index): apply it to the staging branch before merging, then to production before merging the release PR. Use task migrate-up with DB_ADDR set to that Neon branch's direct URL.
  • Destructive (drop or rename a column, add NOT NULL without a default): ship it over two releases. First release code that no longer depends on the old shape, then migrate.

CI's db-integration job has already applied these up, down, and up again on a throwaway database.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant