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

Better database migrations handling #28

Closed
YuukanOO opened this issue Aug 5, 2023 · 2 comments
Closed

Better database migrations handling #28

YuukanOO opened this issue Aug 5, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request released

Comments

@YuukanOO
Copy link
Owner

YuukanOO commented Aug 5, 2023

At the moment, it feels like migrations are not applied in a transaction and as such could make the database inconsistent and unusable if a migration has failed. This should be improved.

To make sure migrations are applied in a specific order, it will be better to accept an array of migrations dir instead of an unordered map:

func (db *database) Migrate(migrations MigrationsDir) error {

@YuukanOO YuukanOO added the enhancement New feature or request label Aug 5, 2023
@YuukanOO YuukanOO added this to the Next milestone Aug 5, 2023
@YuukanOO YuukanOO self-assigned this Aug 5, 2023
@YuukanOO
Copy link
Owner Author

YuukanOO commented Aug 6, 2023

Looks like migrations are applied in a transaction but if it fails, go-migrate will still set the version to the failed one with the dirty flag set to 1 so a user intervention is necessary.

I'm not sure about this but migrations should not fail in a release environment, so maybe that's pointless after all. Migrations could fail when developping but that's all.

YuukanOO added a commit that referenced this issue Aug 6, 2023
YuukanOO added a commit that referenced this issue Sep 19, 2023
@YuukanOO YuukanOO removed this from the Next milestone Nov 17, 2023
@YuukanOO
Copy link
Owner Author

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

1 participant