Migrations #
IMPORTANT!
The SQL file should be placed in directorydatabase/migrations/mysql
ordatabase/migrations/postgresql
Local setup #
Migrate
migrate.up:
migrate -path $(MIGRATION_FOLDER) -database "$(DATABASE_URL)" up
Rollback
migrate.down:
migrate -path $(MIGRATION_FOLDER) -database "$(DATABASE_URL)" down
Docker setup #
Migrate make docker.migrate.up
docker.migrate.up:
docker exec -it --user gfly gfly-web migrate -path $(MIGRATION_FOLDER) -database "$(DATABASE_URL)" up
Rollback make docker.migrate.down
docker.migrate.down:
docker exec -it --user gfly gfly-web migrate -path $(MIGRATION_FOLDER) -database "$(DATABASE_URL)" down 1
NOTE
DB migration auto run for everytime you start docker.