Migration error from v0.43 to v0.44 - onboarded_workspace_requires_default_role

Hi! I am migrating my installation from v0.33 to actual, step-by-step. Everything was going great, but when I tried to migrate from v0.43 to v0.44 - I faced next error:
PENDING_CREATION', 'ONGOING_CREATION') OR "defaultRoleId" IS NOT NULL)
query failed: ALTER TABLE "core"."workspace" ADD CONSTRAINT "onboarded_workspace_requires_default_role" CHECK ("activationStatus" IN ('PENDING_CREATION', 'ONGOING_CREATION') OR "defaultRoleId" IS NOT NULL)
error: error: check constraint "onboarded_workspace_requires_default_role" of relation "workspace" is violated by some row
Migration "AddWorkspaceConstraint1742998832316" failed, error: check constraint "onboarded_workspace_requires_default_role" of relation "workspace" is violated by some row
PENDING_CREATION', 'ONGOING_CREATION') OR "defaultRoleId" IS NOT NULL)
query failed: ALTER TABLE "core"."workspace" ADD CONSTRAINT "onboarded_workspace_requires_default_role" CHECK ("activationStatus" IN ('PENDING_CREATION', 'ONGOING_CREATION') OR "defaultRoleId" IS NOT NULL)
error: error: check constraint "onboarded_workspace_requires_default_role" of relation "workspace" is violated by some row
Migration "AddWorkspaceConstraint1742998832316" failed, error: check constraint "onboarded_workspace_requires_default_role" of relation "workspace" is violated by some row
my workspace's defaultRoleId is empty indeed. What did I miss?
6 Replies
GUFDERALD
GUFDERALDOP5d ago
Full output, if might be useful:
Prastoin
Prastoin4d ago
Hello there ! It seems like you missed a migrate prod sub version command Can you find roles table your core pg schema ? If yes then you could manually update your workspace entry roleDefaultId to be the one of your choice
GUFDERALD
GUFDERALDOP3d ago
Okay, we ended up starting from scratch with clean database. Another question here - are yarn database:migrate:prod and yarn command:prod upgrade cumulative? Is it possible to skip a version or two within migration process? I see in upgrade guide that there is no yarn command:prod upgrade-0.42 and just yarn command:prod upgrade starting from v0.43.0.
Prastoin
Prastoin3d ago
I see in upgrade guide that there is no yarn command:prod upgrade-0.42 and just yarn command:prod upgrade starting from v0.43.0.
Yes because upgrade commands get versioned along current pulled twenty's version, which means you need to upgrade from previous to next without skipping versions Also starting from 0.50, the migrate and upgrade commands are directly done within the DockerFile You can still run upgrade manually if necessary but high chance your workspace has already been migrated and ends up in a message such as "workspace already in higher version" etc
GUFDERALD
GUFDERALDOP3d ago
Copy that. Thanks!
Prastoin
Prastoin3d ago
My pleasure ! Feel free to reach out if you face any migration issue, enjoy coding !

Did you find this page helpful?