Repository navigation
fix(db): restore is_demo_org dropped in #1500 - #1628
Merged
Merged
Conversation
Released app versions (1.2.3 and earlier) still read and write org_settings.is_demo_org, so dropping it breaks migrating the database before upgrading the app, and rolling the app back. Re-add it with its original definition (boolean NOT NULL DEFAULT false). Current app code keeps not using it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an integration test running 1.2.3's org_settings insert and is_demo_org read, and note in the migration when the column can be dropped and that a lock timeout can be retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
reitblatt
marked this pull request as ready for review
November 19, 2026 21:21
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
juanmrad
approved these changes
Nov 20, 2026
Member
|
I don't think we need integration tests, but fine to keep. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context & Requests for Reviewers
#1500 dropped
org_settings.is_demo_org. Current code doesn't use it (#1448 removed it), but released versions up to 1.2.3 still read it (myOrg.isDemoOrg) and write it (ensureOrgSettingsRow). So if you migrate the DB before upgrading the app, or roll the app back, those versions break. #1500 hasn't shipped in a release yet. See RFC #1627 for more context.This adds a new migration that brings the column back as it was before #1500 (
boolean NOT NULL DEFAULT false, no index). It usesADD COLUMN IF NOT EXISTSwithlock_timeout = 5s. With a constant default, Postgres 11+ makes this a metadata-only change. The #1500 migration is unchanged. Current code still doesn't use the column, and a column comment marks it as kept only for compatibility.Tests (executed by Claude Code)
pg_dump -sschemas.org-settings-legacy-compat.integ.test.tsruns 1.2.3'sorg_settingsinsert andis_demo_orgread. It fails without the column and passes with it.pnpm --filter server run typecheck,lint,prettier, and the org GraphQL module andncmec-org-settingsintegration tests pass.(Optional) Rollout Plan
#1500 hasn't shipped, so deployments <= 1.2.3 that upgrade run #1500's drop and then this migration back to back. While the two run, a live 1.2.3 app can briefly fail org-settings queries. If the 5s lock timeout is hit, rerun the migration (it is idempotent).
Release notes
Checklist
Only check items that apply to this PR; leave the rest unchecked.
If you changed anything user-facing (i.e. user interface or APIs):
Did you update related docs?
If the change is notable (refer to Keep a Changelog conventions):
Did you fill in the Release notes section above?
If this PR fixes a security vulnerability:
Did you apply the
security-updatelabel, or ask a maintainer to? Don't describe the vulnerability here before its advisory is published.If you changed
db/src/scripts/**and usedCREATE TABLE,ADD COLUMN, orALTER COLUMN:Are as many columns marked
NOT NULLas possible? If some columns can sometimes be null depending on other columns, are thereCHECKconstraints capturing those relationships, and are these also reflected using unions in the associated Kysely types?If you added a new signal in
server/services/signalsService/signals/**:Did you classify every error case as a permanent error (
SignalPermanentError, no retry) or a normal error (retryable)? Any case where the signal can't determine a score should be aSignalPermanentError.