P
Prisma3mo ago
Manab

How to clone/migrate data from prisma postgresql to self hosted pg

I have a dev database on prisma pg which I have been using for production and i have accumulated some user data(23MB). What is the best way to migrate/clone the database to a (1) prisma production database and (2) self hosted coolify postgresql? I have tried connecting both(prisma & coolify) of them via pgadmin 4 and tried a simple backup and restore approach which failed(partially), seeing the data on the target database but pgadmin said "failed" with getting error:
.
pg_restore: error: could not execute query: ERROR: unrecognized configuration parameter "transaction_timeout"
.
.
.
pg_restore: error: could not execute query: ERROR: role "prisma_migration" does not exist
.
.
pg_restore: error: could not execute query: ERROR: unrecognized configuration parameter "transaction_timeout"
.
.
.
pg_restore: error: could not execute query: ERROR: role "prisma_migration" does not exist
.
My web app is based of nextjs, prisma+postgres which got a huge traffic(150k views) so i am migrating from vercel and prisma to coolify for affordability! Another thing is, i have pushed 2 dev migration to the prisma postgres.
5 Replies
Prisma AI Help
Prisma AI Help3mo ago
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
Nurul
Nurul3mo ago
Upgrade Prisma Postgres from Early Access | Prisma Documentation
Upgrade your Prisma Postgres database from Early Access database to General Availability database.
Manab
ManabOP3mo ago
@Nurul thanks for the reply, I was able to move data to my new database. But My actual problem has always been with the prisma migration files. As far as i know i have pushed my second migration to remote db with "npx prisma migration dev"(i should have use 'deploy' though) and I though my migration was successful as i have seen all the intended changes(addition of some new tables and enum) in prisma studio and have been using it for my "production". After I have learnt that I should use "deploy" to sync migration then i tried that and got a error saying enum "MyEnum" already exist. Now I am trying to handle the failed migration, but how am i supposed to? I could just mark it as "resolved" but i don't know why it was not already. is that the right thing to do?
Manab
ManabOP3mo ago
No description
Manab
ManabOP3mo ago
just ran this against my remote database: npx prisma migrate diff --from-url "$DATABASE_URL_PROD" --to-schema-datamodel schema.prisma --script > forward.sql and it generate a empty migration file. So can i just mark my remote environment as resolved?

Did you find this page helpful?