I need help on deploying my development database to production without losing any data
I mistakenly ran the command
npx prisma migrate dev
on my production env but did not accept when the message says that it would result in resting the database
Basically what I have been doing until now is developing all our backend and database migrations on a development branch and merging them in production branch and applying the migration to production env with npx prisma db push
but know when I ran npx prisma migrate dev
it would reset the database, and I am afraid of running npx prisma db push
and not even give me the change of canceling if it resets my database
this is the message
8 Replies
Project ID:
1862ff4f-3f51-4d9c-a0c3-26d926471f99
1862ff4f-3f51-4d9c-a0c3-26d926471f99
you are responsible for your own data, railway will not be held accountable for data loss caused by the user
your databases should not be stored in the main service. This is what’s causing the loss of data
create a new db service and store your data there
I didnt loose any data
this is what I am trying to understand, I understood that there must be incosistent database schema from my development and main branch but when I merge I dont expect to loose data
how should I do it in a way to avoid these loss?
what do you mean my database should not stored in the main service?
also is there a way to know which data I will loose before running
prisma migrate deploy
because what I am doing as metioned before is having 2 env PRODUCTION and DEVELOPMENT as normal, DEVELOPMENT is always ahead of PRODUCTION
when I finish a feature I merge DEVELOPMENT to PRODUCTION and push the changes,these are more so questions for the prisma docs
now whats happening is before pushing the changes I want to update my PRODUCTION database schema with the updates that came from DEVELOPMENT on merge
on DEVELOPMENT there are some tables I am droping and some required and unique fields that are not unique anymore, by running
prisma migrate deploy
or prisma db push
can I know before running this the result of my database
its ok to loose data that I intend but not resetting the databaseSolution