Migrate: Lift: introduce a delete/reset command

Created on 30 Oct 2019  路  7Comments  路  Source: prisma/migrate

Developers often have to run a full database cleanup for development or testing purposes. This is why it would be useful if lift would come with a delete CLI command, which drops the database: prisma2 lift delete.

Similar from the Prisma 1 behavior, this command could warn if there is existing data which would be deleted, but this again could be overridden by a --force flag: prisma2 lift delete --force. Maybe this command needs extra warnings or flags/checks to be extra cautious to prevent accidental usage.

An alternative name could be reset to communicate a full database reset instead of just deleting data, or both commands could be introduced to provide both behaviors.

datamodel-migrations kinfeature teamigrations

Most helpful comment

This seems okay as a temporary solution, but I am definitely in favor of introducing a new reset command due to various reasons. For now, I remove the database by removing the sqlite file and then run prisma lift up.

All 7 comments

Now that I think about it, this could also live in the query engine. This would mean it's easy to delete database contents from Photon clients programmatically (even if it's just used internally for testing and not exposed as a method).

Usually referred to as prisma reset until now: https://github.com/prisma/specs/issues/261

Didn't see the other issue; maybe we should close one of the issues as duplicate

For now this is ok, we will go through the issues soon-ish and clean up. Yours actually provides some text explanation for people that do not know what this is about ;)

my perspective so far on this has been to suggest:

prisma lift down && prisma lift up

Would that solve your use case?

This seems okay as a temporary solution, but I am definitely in favor of introducing a new reset command due to various reasons. For now, I remove the database by removing the sqlite file and then run prisma lift up.

Closing this, as we have prisma migrate reset now. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julien1619 picture julien1619  路  3Comments

MichalLytek picture MichalLytek  路  3Comments

hamidb80 picture hamidb80  路  4Comments

mariushab picture mariushab  路  3Comments

jwld picture jwld  路  3Comments