sqitchers / sqitch

Sensible database change management
https://sqitch.org
MIT License
2.78k stars 215 forks source link

Add ability to purge a project #187

Open Ovid opened 10 years ago

Ovid commented 10 years ago

Request

I would like the ability to completely purge a project from the sqitch schema without manually going in and deleting everything.

$ sqitch purge my_project
WARNING: You are about to completely remove all traces of 'my_project' from
sqitch!! Are you absolutely sure you want to do this? [y/N]

Rationale

I'm doing a huge amount of sqitch development for a client and many times I'm temporarily adding a sqitch project, only to need to either remove it permanently, or remove it temporarily while the project work is being redone. Scrubbing the data from the sqitch schema manually is not only time-consuming, but it's also fraught with danger due to issue #185 (no FK constraints in the sqitch schema).

As an alternative, setting a boolean flag on projects table to mark it as purged would allow one to do this:

$ sqitch restore my_project
theory commented 10 years ago

I'm assuming you have multiple projects in a single database? Doesn't sqitch revert do the trick? If it's only because it leaves rows in the log table (see also #185), perhaps an option to revert could tell Sqitch to also remove the log entries. Maybe sqitch revert --purge?

Ovid commented 10 years ago

Yes, we have multiple projects in a single database. Having a --purge option would be nice with revert, though I can see danger there :) But you're right, it's all of the log events which are then frustrating. Plus, there's at least on time I've dropped a project and never added it back (that may happen again in the future).