Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a ListDBMigrations function in provider #905

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

the-glu
Copy link

@the-glu the-glu commented Feb 5, 2025

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.

@mfridman
Copy link
Collaborator

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?

@the-glu
Copy link
Author

the-glu commented Feb 13, 2025

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants