migrate
migrate copied to clipboard
one sql file only can execute one sql
if I write multiple sql in migrate file,this migrate execute failed, SQL has error。 but this sql can be execute succeed in sql client。
@wwbb2008 You should enable multi-statement in the config for the migrator. Add a query parameter to the URL conn string or enable it in the Config struct passed into the migrator constructor. Here is a reference for Postgres as an example: https://github.com/golang-migrate/migrate/blob/691bc773cc0f8492431cefda5396bbc2e4eea63d/database/pgx/README.md?plain=1#L12
https://github.com/golang-migrate/migrate/blob/master/database/postgres/postgres.go#L49