lecaillon / Evolve

Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
https://evolve-db.netlify.com
MIT License
853 stars 112 forks source link

Add a `Drop` command to Evolve. #277

Open Meigs2 opened 2 years ago

Meigs2 commented 2 years ago

Add Drop command to Evolve

Hi! I'd like to get thoughts on adding a Drop command to the Library and CLI tool. Some other database versioning systems like DbUp and Grate let you drop the entire database as a command, usually as part of a build step for running integration tests.

I am using Evolve right now in a project and noticed it does not have this functionality. Currently, I am manually dropping the database in powershell before migrating using a custom CLI tool I wrote for versioning the app that uses Evolve. I feel it would be beneficial to add a Drop command to facilitate integration testing as part of a build step.

If this is something that fits within the scope of the project, let me know and I'll get started working on a PR to add the functionality.

Meigs2 commented 2 years ago

Updated! I hit enter slightly too early 😅

Meigs2 commented 2 years ago

Just to add some more detail/clarification here, the Drop command would essentially connect to the cluster, drop the database specified in the connection string, then proceed as if the Migrate was executed. If evolve doesn't already create the database specified in the string before running its migrations, it would CREATE DATABASE and then migrate.

Would Recreate or another command name be more clear?