直接取 这里下载,或者运行make db-migrate-setup
make db-migrate-create table=xxx
或者直接跑migrate命令
migrate create -ext sql -dir internal/models/migration op_log_table
参考:
20231227072912_op_log_table.up.sql
20231227072912_op_log_table.down.sql
make db-migrate-up uri='mysql://vmihub:******@tcp(10.200.0.188:3306)/vmihub_test?parseTime=true'
或者直接运行migrate命令
migrate -database 'mysql://vmihub:******@tcp(10.200.0.188:3306)/vmihub_test?parseTime=true' -path ./internal/models/migration up 1
make db-migrate-down uri='mysql://vmihub:******@tcp(10.200.0.188:3306)/vmihub_test?parseTime=true' N=1
或者直接运行migrate命令
migrate -database 'mysql://vmihub:******@tcp(10.200.0.188:3306)/vmihub_test?parseTime=true' -path ./internal/models/migration down