jdavisclark / mite

schema migrations so easy you already know how to write them. guaranteed.
http://jdc0589.github.io/mite
11 stars 6 forks source link

`mite confirm` #17

Open soitgoes opened 10 years ago

soitgoes commented 10 years ago

Mite confirm would be really nice. It could create a 'mite_tmp' db and run init and all the ups then run all the downs and if anything errored it would return failure with a sql stacktrace and the file it was executing. If it was successful it would return success.

This could be written into a git hook that could be installed via npm, in similiar fashion to precommit-hook. So that migrations that are invalid would never get on the source control.

notduncansmith commented 10 years ago

Agreed that this would be valuable (pseudo-integration test). Maybe a --dry-run flag on mite up would be a better place for this functionality? This would be consistent with other utilities that provide similar functionality.

Also, with the mite_tmp database, I feel like it should be dropped regardless of whether the dry run was successful or not. The only drawback to that is that the developer loses access to the temporary database for inspection. A possible solution would be to include a SQL dump of mite_tmp, along with the stacktrace of whatever the error was, in a dryrun.dump file.