Portfolio API created with Golang.
今回データベース構築はmigrateでcliで実行しています。
https://github.com/golang-migrate/migrate/tree/master/cmd/migrate
Linux
curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz
MacOS(Homebrewを使用)
brew install golang-migrate
Moduleをinstall。今回はmysqlを使用
go get -tags 'mysql' -u github.com/golang-migrate/migrate/cmd/migrate
https://github.com/golang-migrate/migrate/tree/master/database/mysql
migrate -source file://migrations/ -database 'mysql://root:@tcp(127.0.0.1:3306)/blog_db' up 1