Issue with yarn database:migrate:prod on version 0.43 β duplicate key value error
Hey everyone,
I'm encountering an error while running the migration for version 0.43 with the following command:
yarn database:migrate:prod
Error Message: QueryFailedError: duplicate key value violates unique constraint "IndexOnNameObjectMetadataIdAndWorkspaceIdUnique"
Key (name, "objectMetadataId", "workspaceId")=(body, afd4a320-c752-43e2-a7ce-74bf2b4b84f9, a1efc3dc-e551-44bd-bf80-b053f3af3ada) already exists.
Is there a known fix for this duplicate key issue in 0.43?
I had the error on production and also locally. Using the postgres image and the twenty-postgres:v0.32 image.
Thanks in advance for your help! π12 Replies
Hi! So you are in 0.42 and you are following https://twenty.com/developers/section/self-hosting/upgrade-guide#v0.42.0-to-v0.43.0 ?
Can you tell me the name of the objectMetadata having the id afd4a320-c752-43e2-a7ce-74bf2b4b84f9 ?
Thank you Thomast and sorry for my late respond. I got no notification. Yes, and I was doing option 2. The Name is "note".
Hi @berrylu, did you manage to perform the migration?
Unfortunately not, I am also having the same trouble with it on another instance :/
in your fielmetadata table, do we agree you only have one object named
body
associated with objectMetadataId afd4a320-c752-43e2-a7ce-74bf2b4b84f9
?
I don't get why the command tries to create a new field@thomast yes, there is only one entry for
When I go through all entries where "objectMetadataId" matches the uuid above, there is also one entry named "bodyV2". But this is fine right?
Yes this is fine. Could you please go to your DB and tell me:
- in the schema core, _typeorm_migrations table, what's the name of the last migration that has been run?
- same with the schema metadata, _typeorm_migrations
Thank you thomast, helping me. I am currently on my dev environment getting the same error. So we can try things without problems first. These are the returned data sets
ok I see nothing related
@Etienne would you know anything about it? I see a commit that may be intended for fixing this https://github.com/twentyhq/twenty/commit/258025a18f5d5ada8dd57c03cb1544870b270ede
GitHub
Fix upgrade-0-42 command to migrate RICH_TEXT field metadata to RIC...
β¦TEXT_V2 (#10218)
While making sure the upgrade-0.42 command was working as expected to
upgrade from 0.41 to 0.42, we've detected that the standardId of the new
bodyV2 (type RICH_TEXT_V2...
my bad this is @charles one
reminder @charles
Hi @berrylu, could you ping me in DM, let's schedule a call to fix the issue