my database is deleted but i have the migration fi...
# orm-help
a
my database is deleted but i have the migration files , and i create a new database , what should i do now ? prisma migration dev or prisma migration deploy
👀 1
n
Hello @abdoaligomaa107 👋 For production databases, you should use
migrate deploy
and for development databases you can use
migrate dev
. Migrate dev command should not be used for the production databases. This reference for Prisma Migrate in development and production should be helpful: Reference
a
now i need to know when i have a migration files and i have an empty database. and i am in development environment if i use prisma migrate dev , it will gengerate an other migration dev ? @Nurul
n
On an empty database, migrate dev will rerun the migrations which are not executed on the database. Can you please elaborate on
it will gengerate an other migration dev ?
I didn’t get it.
v
👋 Hi @abdoaligomaa107 - have you perhaps had a chance to check Nurul's question? Let us know if you still need help here!
d
FWIW Migration files are redundant to your prisma schema - they exist to make tweaks to a live system. Absent an existing database, scrubbing your migrations are the easiest path forward.
The idea behind migrations is that a developer has a local database that is based on the shared schema (in production and on other local databases). If they want to change the schema, they can do a pull of master, branch out, change their dev DB by creating migration(s), and another dev can then check out the committed migrations / code in THEIR local system before approving the PR, so you can evaluate DB changes before affecting production systems. In the absence of a production DB with important data, the schema file is all you need to jump-start your system.