docs: clarify annotation requirement and ordering ()

pull/446/head^2
Michael Fridman 2023-01-24 08:30:14 -05:00 committed by GitHub
parent 74eaeab8ad
commit 635add3280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -216,6 +216,9 @@ CREATE TABLE post (
DROP TABLE post;
```
Each migration file must have exactly one `-- +goose Up` annotation. The `-- +goose Down` annotation
is optional. If the file has both annotations, then the `-- +goose Up` annotation **must** come first.
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 TRANSACTION` to the top of your migration