goose icon indicating copy to clipboard operation
goose copied to clipboard

feat: Add a ListDBMigrations function in provider

Open the-glu opened this issue 11 months ago • 4 comments

Hello,

I'm developing a tool to manage our project's migration, and I would like to list the current migrations in the database to be able to enforce various checks (like "is there migrations in the database not present in the current migration set?").

Right now there seems to be no options to list those database migrations form the Provider API, this PR add a simple function that return those, allowing for flexibility on 'our side' without the needed of adding specific checks.

the-glu avatar Feb 05 '25 09:02 the-glu

The provider currently has 2 methods:

Both of these aim to report whether there are new migrations and the versions (current and target). Are these methods insufficient for your needs?

mfridman avatar Feb 13 '25 02:02 mfridman

No there aren't: HasPending is only telling me if there are unapplied migrations and GetVersion is only working with current migrations and checking the status in the database.

What I would like to detect, is if there is any 'unknown' = 'not registered' migration in the database.

Instead of adding a specific function to do this specific check, this PR add the method to return those DB migrations, to also allow potential others checks if needed when using goose as a library :)

the-glu avatar Feb 13 '25 07:02 the-glu

Hello,

Just a gentle reminder about this PR, do you have time for a quick check ? There is also #906 waiting :)

Thanks in advance,

the-glu avatar Jun 17 '25 13:06 the-glu

Sorry, been a bit swamped (but still maintained). I'll try to get to this shortly, will carve out some time over the weekend to properly review.

mfridman avatar Jun 17 '25 13:06 mfridman