Upgrade error 0.3.2 > 0.3.3 : duplicate key value violates unique constraint

duplicate key value violates unique constraint "IndexOnNamePluralAndWorkspaceIdUnique"
yarn command:prod workspace:health -w 75f6e77a-ec52-43fd-af2b-5e1ca8319b2e
yarn command:prod workspace:health -w 75f6e77a-ec52-43fd-af2b-5e1ca8319b2e
reports healthy but:
yarn command:prod workspace:sync-metadata -w 75f6e77a-ec52-43fd-af2b-5e1
ca8319b2e -d
yarn command:prod workspace:sync-metadata -w 75f6e77a-ec52-43fd-af2b-5e1
ca8319b2e -d
fails with:
detail: 'Key ("namePlural", "workspaceId")=(activityTargets, 75f6e77a-ec52-43fd-af2b-5e1ca8319b2e) already exists.'
detail: 'Key ("namePlural", "workspaceId")=(activityTargets, 75f6e77a-ec52-43fd-af2b-5e1ca8319b2e) already exists.'
I tried deleting in "metadata"."objectData" to see if it had any effect but it did not:

delete from "metadata"."objectMetadata" where "namePlural"='activityTargets';
DELETE 2

delete from "metadata"."objectMetadata" where "namePlural"='activityTargets';
DELETE 2
115 Replies
charles
charles5mo ago
Hi @🅹🅰🆈🅱🅴🅴 do you have data in your workspace? If yes you should not delete things from metadata We have introduced the notion of "standard-ids" recently, I think you are missing it
🅹🅰🆈🅱🅴🅴
test server so it is not an issue
charles
charles5mo ago
ok! do you see a standard-id column in your field metadata table? If yes, you should run first: yarn command:prod workspace:add-standard-id (Note that we are on 0.10.0, I can help you migrate directly to this version if you want)
🅹🅰🆈🅱🅴🅴
That might be beneficial yes. Lets see if I can push it to test. I know there was changes with server/frontend not sure if I managed to fix those yet
charles
charles5mo ago
have you added some code on your side? or you are using twenty public images?
🅹🅰🆈🅱🅴🅴
Using twenty public but the docker compose and nginx config needs some love. You merged the images and I havent had a chance to test the changes that was needed. I'll ping back here when It's up and running.
charles
charles5mo ago
ok! it should be easier than before the postgres database is still separated so you should be able to connect it to the new twenty instance
🅹🅰🆈🅱🅴🅴
Most likely tomorrow though, time for dinner and family! 🙂
charles
charles5mo ago
Bon appetit! Ping me if/when you need help
🅹🅰🆈🅱🅴🅴
I'm now getting an error when I try and run migrate:prod in v0.10.0 so I believe it to be functioning. I can't login but I assume that's because of database migrations not finishing attaching output of yarn database:migrate:prod
🅹🅰🆈🅱🅴🅴
\d "core"."user":
🅹🅰🆈🅱🅴🅴
@charles "ping" 🙂
charles
charles5mo ago
mmh, there is an issue with migrations. What do you have in your core._typeorm_migrations table? I think there is a mistake in our migration. I can fix it on main and push a patch to v0.10 but it wont help you right now. I think it's in 1711557405330-addMissingMigration line 39. What you can do is to manually add this constraint to your user table so the migration run
🅹🅰🆈🅱🅴🅴
select * from "core"."_typeorm_migrations";
id | timestamp | name
----+---------------+-----------------------------------------------------
1 | 1700324860820 | SetupCoreTables1700324860820
2 | 1700654387203 | AddAllowImpersonationToWorkspace1700654387203
3 | 1700661180856 | AddCascadeDeleteOnRefreshTokenUser1700661180856
4 | 1700663611659 | AddWorkspaceDeleteCascadeSetNullInUser1700663611659
5 | 1701194529853 | AddFeatureFlags1701194529853
6 | 1702479005171 | AddSubscriptionStatusOnWorkspace1702479005171
7 | 1704825571702 | AddPasswordResetToken1704825571702
8 | 1706613419989 | AddDefaultAvatarUrlToUser1706613419989
9 | 1707778127558 | AddUserWorkspaces1707778127558
10 | 1708535112230 | AddBillingCoreTables1708535112230
11 | 1709233666080 | UpdateBillingCoreTables1709233666080
12 | 1709314035408 | UpdateUserWorkspace1709314035408
select * from "core"."_typeorm_migrations";
id | timestamp | name
----+---------------+-----------------------------------------------------
1 | 1700324860820 | SetupCoreTables1700324860820
2 | 1700654387203 | AddAllowImpersonationToWorkspace1700654387203
3 | 1700661180856 | AddCascadeDeleteOnRefreshTokenUser1700661180856
4 | 1700663611659 | AddWorkspaceDeleteCascadeSetNullInUser1700663611659
5 | 1701194529853 | AddFeatureFlags1701194529853
6 | 1702479005171 | AddSubscriptionStatusOnWorkspace1702479005171
7 | 1704825571702 | AddPasswordResetToken1704825571702
8 | 1706613419989 | AddDefaultAvatarUrlToUser1706613419989
9 | 1707778127558 | AddUserWorkspaces1707778127558
10 | 1708535112230 | AddBillingCoreTables1708535112230
11 | 1709233666080 | UpdateBillingCoreTables1709233666080
12 | 1709314035408 | UpdateUserWorkspace1709314035408
charles
charles5mo ago
actually, it looks legit in Twenty codebase, I don't get why you were missing this constraint
No description
Want results from more Discord servers?
Add your server