twenty icon indicating copy to clipboard operation
twenty copied to clipboard

`relation "core.user" does not exist` after upgrading v0.1.5 to v0.2.1

Open joshuajung opened this issue 1 year ago • 6 comments
trafficstars

Bug Description

I upgraded my self-hosted Twenty instance from v0.1.5 to v0.2.1 by switching to the new Docker images from Docker Hub. Now, when trying to sign in, I can see this error message in the client console:

{"errors":[{"message":"QueryFailedError","locations":[{"line":2,"column":3}],"path":["checkUserExists"],"extensions":{"code":"INTERNAL_SERVER_ERROR","response":"relation \"core.user\" does not exist"}}],"data":null}

Are there any migrations that need to be run manually? I found nothing in the Release Notes.

Expected behavior

Sign in works as usual.

joshuajung avatar Dec 16 '23 16:12 joshuajung

Ok, from 0.1.5 to 0.2.1, we have introduced many breaking changes. Do you have any data you want to keep? If not, I think the shortest way is to reset your database: yarn database:reset on server

charlesBochet avatar Dec 18 '23 07:12 charlesBochet

If you have data that's another story, I would say the shortest way is to create another database "default-new" that you can init through yarn database:init and then to move your stuff from the old to the new with SQL/Postgres client UI directly

charlesBochet avatar Dec 18 '23 07:12 charlesBochet

Yes, we have a production instance of Twenty with quite a few records... maybe that was a bit naïve with the early version, but the team really enjoyed it. :-)

I'm not sure if I feel comfortable moving stuff by hand on a trial and error basis, to be honest. Do you think there is a chance that a migration script or instructions may become available at some point in time?

joshuajung avatar Dec 18 '23 10:12 joshuajung

@joshuajung Twenty is not production ready for self-hosting yet :( I think, when it will, we will release 1.0.0

In the meantime, we are happy to assist you manually. Could you open a thread in our discord #help channel and I can guide you on the best way to do it. We won't be able to provide script at this point but if you have a low number of record, it should be straight forward to migrate it to 0.2

charlesBochet avatar Dec 18 '23 10:12 charlesBochet

Thank you @charlesBochet! I'll make sure to do that as soon as I have some time to follow up more or less in real time.

joshuajung avatar Dec 18 '23 20:12 joshuajung

I'm finally back from my vacation and very motivated to get this done. :-)

I have set up an entirely new environment with a clean database and the v0.2.2 Docker images. However, the server Docker image no longer seems to automatically run migrations upon first launch. Is this intended? Should I run the migrations to create the initial database layout manually using the yarn database:setup:prod command?

joshuajung avatar Jan 08 '24 13:01 joshuajung

Hi @joshuajung! Yes it is intended in the current version. and yes you can run yarn nx database:setup:prod to setup your production database correctly :)

charlesBochet avatar Jan 11 '24 11:01 charlesBochet

Thank you @charlesBochet!

Unfortunately, I didn't get far, as Google Cloud SQL (still our host) doesn't seem to support the pg_graphql extension (also as per https://github.com/orgs/supabase/discussions/6506). I guess I would have to run our own Postgres container, which would then be fully configurable.

For the moment, that's unfortunately too much effort for me, especially as the team seems to be happy on v0.1.5. I'll put our legacy installation behind a VPN for added security. keep an eye on you folks' progress and probably plan a big bang upgrade of our installation once you hit v1.0. :-)

joshuajung avatar Jan 11 '24 12:01 joshuajung

Ok, makes sense :) We will also probably provide pre-configured docker-compose and helm charts for self-hosting in the upcoming months

charlesBochet avatar Jan 11 '24 13:01 charlesBochet

@charlesBochet @joshuajung How can we configure the database or execute migrations when we're self-hosting on AWS ECS Fargate using the default container images? i don't find a way to run the commands n aws ecs

venkatesh22 avatar Mar 11 '24 17:03 venkatesh22

It looks like there is a bit of config to be done: https://dev.to/femilawal/how-to-ssh-into-an-ecs-fargate-container-1l3k

charlesBochet avatar Mar 12 '24 10:03 charlesBochet