I am fairly new to golang, and trying to identify the best tools for the job. Currently I am evaluating the following packages:
https://github.com/mattes/migrate
https://github.com/DavidHuie/gomigrate
https://bitbucket.org/liamstask/goose/
I was wondering if anyone had any experience with these (or other packages) and could provide some comments.
Create a new migrationStart with migrate create . Then the extension of the file will be sql , and the directory to store it is db/migration . We use the -seq flag to generate a sequential version number for the migration file. And finally the name of the migration, which is init_schema in this case.
Step 1: Open the terminal for executing the installation commands. Step 2: Let us setup the repository to install the migrate package. Step 3: Update the system by executing the following command. Step 4: Now, it's time to set up golang migrate.
We use mattes/migrate
at work and are very happy with it. It works with plain SQL files, handles file naming by itself and can easily be automated via CLI. It doesn't do anything Go specific.
With gomigrate
you need to create the files yourself and write code for executing the migrations.
Take a look at https://github.com/pressly/goose, a maintained fork of https://bitbucket.org/liamstask/goose/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With