Migrations
π¨βπΌ Alright, let's get our migration file generated.
π¨ Run the following command:
npx prisma migrate dev
It will ask if you want to delete data. Say "yes" (we're going to generate it
all anyway).
It will ask you what to call the migration. I call the first migration "init".
Now check your
prisma/migrations
folder and you'll see the new file there. The
migration file is in a directory named after the timestamp of when it was
created and the name you provided. This is so that Prisma can keep track of the
order of migrations.You'll also notice .
Prisma uses this to make sure you don't change the database provider. Prisma
doesn't support changing from Postgres to SQLite as part of a migration. If you
want to do that, it's
a little more involved
(though easier than it should be thanks to Prisma). I have done this and it went
really well:
I Migrated from a Postgres Cluster to Distributed SQLite with LiteFS