How to add an empty migration in prisma?
Asked Answered
A

1

7

I need to add an empty migration to write a SQL query and manipulate the data manually.
There is no change in my schema and basically, I just need to apply this query to my existing data.

Aweinspiring answered 15/3, 2023 at 15:26 Comment(0)
A
18

Recommended way:
Add --create-only to your command.

prisma migrate dev --create-only --name <NAME_OF_YOUR_MIGRATION>

A trick I used before knowing the above solution:
Make a change on your schema and then run the command to create the migration folder, then remove the migration file's content, also remove changes from the schema file and write what ever you want!
Aweinspiring answered 15/3, 2023 at 15:26 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.