squeal icon indicating copy to clipboard operation
squeal copied to clipboard

Checking performed migrations

Open tuomohopia opened this issue 4 years ago • 2 comments

Is there any convenient way to check which migrations are have been run and which have not?

I'd like to always have my app confirm that all the expected migrations exist in Postgres before booting up the server. Including the initial setup (Definition).

As far as I can tell, defaultMain features most of of the functionality needed for this. Is it possible to expose that functionality from the Migration module?

Ideally, I'd like to get a list of up/down migrations to compare against. Something like

main = do
    (initial, up, down) <- checkMigrations connStr migrations
   -- Validate & crash if not correct
   -- Start server

tuomohopia avatar Mar 07 '20 00:03 tuomohopia

I'm open to a PR for this, although migrations have gone thru a bit of change in the dev branch.

echatav avatar Mar 09 '20 16:03 echatav

Got it, I'll figure out something on my own first and then see if it's good enough to be integrated when current dev changes are released as a part of a new version.

tuomohopia avatar Mar 10 '20 14:03 tuomohopia