user22698889
user22698889

Reputation: 31

how to generate a migration file with prisma

I tried this in the repository's prisma folder

npx prisma migrate dev --name add_finance_tables

but it shows this in the terminal

** Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": CockroachDB database "defaultdb"**

i'm expecting a new timestamped migration folder to be made in the migrations folder named timestamp_add_finance_tables (or something like that name)

Upvotes: 3

Views: 8073

Answers (2)

David
David

Reputation: 11

Are you trying to do an empty migration? Try using

prisma migrate dev --create-only

doc

Upvotes: 1

Alexander
Alexander

Reputation: 21

I know this was a while ago but the fix is to first make a change in your schema.prisma file. Add whatever changes you need. Then run the command you are running. It will then notice the changes you made on the file and generate the SQL needed to achieve that change. Hope this helps.

Upvotes: 2

Related Questions