Schema migration is an important activity when dealing with databases that we frequently have to perform during the application’s life cycle to adapt to new business needs. Golang migrate is a tool which helps in this operation.
Installing Golang Migrate on Ubuntu
Step 1: Open the terminal for executing the installation commands.
Step 2: Let us setup the repository to install the migrate package.
curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | sudo bash
Step 3: Update the system by executing the following command.
sudo apt-get update
Step 4: Now, it’s time to set up golang migrate. Execute the following command in the terminal to install migrate.
sudo apt-get install migrate
Now you can use golang migrate to perform database migrations.