Getting view ID missing and view display issues after running DB migration
I first ran into an issue
QueryFailedError: column ViewEntity.universalIdentifier does not exist. I had solved it when running locally by doing npx nx run twenty-server:database:migrate:prod, but eventually had to do npx nx database:reset twenty-server.
Unfortunately, I don't have the option to reset my whole DB on my production instance. I ran a DB migration on production by setting the PG_DATABASE_URL to my production DB url and running the migration command. The original issue with the ViewEntity.universalIdentifier column not existing was resolved, but I've since been running into issues where the viewId is missing from the app's url.
Ex:
- my self hosted app has the url http://{appurl}.com/objects/workflows (no view Id present in the url)
- the twenty web app which is displaying everything correctly has the url https://{subdomain}.twenty.com/objects/workflows?viewId=aa8ab9ce-eaeb-47ad-8803-8ddbd690d781 (viewId present)
Broken functionality:
- This view Id issue is causing a "Current view ID is not defined" error to show up when I try to access resources via CMD + k or if I click "filter" or other buttons
- The default favorites are missing from the workspace sidebar
- No resources are displayed in the view since no viewID is able to be found
Questions:
- What is the proper way to run a DB migration on a self hosted / production instance?
- how can I get viewIDs to be added back to the query params for my self hosted app?
- How can I restore the UI functionality to display views and get rid of this error "Current view ID is not defined" and similar errors (e.g. "Error: Object metadata id is missing from current view")?
2 Replies
The screenshot with "twenty.com" in the url and a correct UI is from the twenty web app.
The two screenshots with errors are from my production / self hosted instance.



Update: I was able to resolve the issue (I think) by running the following commands:
- npx nx run twenty-server:database:migrate:prod
- npx nx run twenty-server:command migrate:views-to-core
I haven't tried running this command yet, just noting that it may be important as well:
- npx nx run twenty-server:command workspace:sync-metadata -f