Database migrations in Go

Go lacks a native migration tool, so use golang-migrate/migrate to execute SQL scripts against your database.

Go does not have a built-in database migration tool; you must use a third-party library like golang-migrate/migrate or write custom SQL scripts. Install the tool and run your migrations with the following command:

go install github.com/golang-migrate/migrate/v4/cmd/migrate@latest
migrate -path /path/to/migrations -database 'postgres://user:pass@host:port/dbname?sslmode=disable' up