Open2
golang-migrate/migrateを使うときはDSNのエスケープに気をつけるべし

$ migrate -source file://path/to/migrations -database postgres://localhost:5432/database up 2
-database
以降の部分がDSNを指定しているところ

Database URLs
Database connection strings are specified via URLs. The URL format is driver dependent but generally has the form: dbdriver://username:password@host:port/dbname?param1=true¶m2=false
Any reserved URL characters need to be escaped. Note, the % character also needs to be escaped
Explicitly, the following characters need to be escaped: !, #, $, %, &, ', (, ), *, +, ,, /, :, ;, =, ?, @, [, ]
重要なのはAny~のところ。URLで特殊文字として扱われる文字はエスケープする必要がある
ローカルの開発環境では、簡単のためにpasswordみたいなものを指定しているケースがあると思う。
いざクラウド上のRDBなどで払い出されたランダムなパスワードを入れてDSNを作ると、エスケープシーケンスのことを忘れていてマイグレーションに失敗するみたいなケースがあったのでメモとして残しておく