Database migrations
This project uses goose for SQLite migrations. Migrations are embedded into the migrate binary at build time.
Quick start
Section titled “Quick start”# Apply all pending migrations (builds ./bin/migrate first)export DATABASE_URL=./database.dbmake migrate-up
# Check statusmake migrate-status
# Roll back last migrationmake migrate-downKey details
Section titled “Key details”- Migration files live in
internal/migrations/sqlite/. - The
make migrate-*targets rebuild./bin/migratefirst (make build-migrate), because migrations are embedded into the binary. DATABASE_URLmust be a file path for SQLite (URL-like values containing://are rejected).
Creating a new migration
Section titled “Creating a new migration”make migrate-create NAME=add_feature_x# edit the generated file in internal/migrations/sqlite/make migrate-up