diff --git a/README.md b/README.md index 3424d75..27bab3a 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ DROP TABLE post; Notice the annotations in the comments. Any statements following `-- +goose Up` will be executed as part of a forward migration, and any statements following `-- +goose Down` will be executed as part of a rollback. -By default, all migrations are run within a transaction. Some statements like `CREATE DATABASE`, however, cannot be run within a transaction. You may optionally add `-- +goose NO TRANSACTIONS` to the top of your migration +By default, all migrations are run within a transaction. Some statements like `CREATE DATABASE`, however, cannot be run within a transaction. You may optionally add `-- +goose NO TRANSACTION` to the top of your migration file in order to skip transactions within that specific migration file. Both Up and Down migrations within this file will be run without transactions. By default, SQL statements are delimited by semicolons - in fact, query statements must end with a semicolon to be properly recognized by goose. diff --git a/example/migrations/00003_no_transaction.sql b/example/migrations/00003_no_transaction.sql index cde06b4..b890c31 100644 --- a/example/migrations/00003_no_transaction.sql +++ b/example/migrations/00003_no_transaction.sql @@ -1,4 +1,4 @@ --- +goose NO TRANSACTIONS -- +-- +goose NO TRANSACTION -- +goose Up CREATE TABLE post ( id int NOT NULL, diff --git a/migration_sql.go b/migration_sql.go index 18be3b9..3b56867 100644 --- a/migration_sql.go +++ b/migration_sql.go @@ -134,7 +134,7 @@ func useTransactions(scriptFile string) bool { log.Fatal(err) } - noTransactionsRegex, _ := regexp.Compile("--\\s\\+goose\\sNO\\sTRANSACTIONS") + noTransactionsRegex, _ := regexp.Compile("--\\s\\+goose\\sNO\\sTRANSACTION") scanner := bufio.NewScanner(f)