-
Notifications
You must be signed in to change notification settings - Fork 19
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
SQL-agnostic version of migrator #33
Comments
Hello, thank you for your words! This is a very interesting concept. I would appreciate if you could elaborate a bit more with some usecase examples. How can this be useful for other go users? Somewhat related with: (Excuse the spanish comments there, but the op explanation and code samples speak for theirselves) CC/ @pablote |
Hi, Well, I'd like to create some migrations that involve calling web APIs and setting up an SQLite database (without any fancy ORM tools). Historically I have been able to implement those with Umzug. I think I was kind of imagining a library that allows me to write such migrations in Go Code (unlike loading SQL files from the FS) and therefore embedd them into a binary. Using such a system would also require to be able to supply the migration log from a different source than a database. |
Thank you for explaining! With migrator you can already write migrations using:
In theory nothing stop you from including api calls into your migrations. I haven't tested, but SQLite should also work well. What is true right now is that you have to use something compatible with stdlib I'll investigate this further along with the tool you mentioned, because I think this might be interesting. Thank you again for raising this! |
Hi, thanks for the reply. Right now I ended up building a very basic migration system myself. I simply using a slice of "singleton structs" which serve as one migration each. While doing so I realized that the basic logic of a migration manager isnt as difficult as I thought. I think that decoupling the migragion log source from the migration source is worth the effort. Same for supporting non-sql migrations. |
I will give this a chance! I think I could implement a storage interface somehow and pass into into migrator as an option, trying to avoid breaking current users as much as possible. Something similar to: https://github.com/sequelize/umzug/blob/master/src/storage/contract.ts |
Nice! If you did that then the old mechanism would have to be refactored to implement that interface. In addition a simple JSON file powered storage would be nice. Depending on how you are planning to implement this, I'd help with implementing either of them, shouldn't be that hard. |
Yup, I just need time, and try to find a way to break the users as less as possible. I also think the memory storage could help with the testing. I will ping you if I start with something. Thank you! |
Hi,
I really like migrator! Overall, it seems like the simplest and versatile migration library in Go I have seen so far.
I have a question: Is there any intend to abstract away the dependency on the
sql
package? I have a Node.js background and I loved working with https://github.com/sequelize/umzug because it enabled me to store the migration state in a JSON file and I could essentially write migrations that aren't even related to SQL.Thanks in advance and stay safe!
The text was updated successfully, but these errors were encountered: