To create a new database migration file, follow these steps:
- Ensure
golang-migrateis installed. - Run the following Makefile command:
make migrate-create
- This will generate a new migration file in the
database/migrations/directory. - Edit the generated migration file to define the required schema changes.
After creating the migration, apply it by running:
Follow these steps to apply database migrations:
- Install
golang-migrateby following the instructions at golang-migrate/migrate. - Set the environment variable
DATABASE_URLwith your database connection string. - Run the following Makefile command to apply the migrations:
make migrate-up