Skip to content

Commit ff1977c

Browse files
authored
Update migration docs
Correct and clarify information around empty migrations Addresses: #244
1 parent 14a3bcd commit ff1977c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

MIGRATIONS.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ It is suggested that the version number of corresponding `up` and `down` migrati
4444
files be equivalent for clarity, but they are allowed to differ so long as the
4545
relative ordering of the migrations is preserved.
4646

47-
The migration files are permitted to be empty, so in the event that a migration
48-
is a no-op or is irreversible, it is recommended to still include both migration
49-
files, and either leaving them empty or adding a comment as appropriate.
47+
The migration files are permitted to be "empty", in the event that a migration
48+
is a no-op or is irreversible. It is recommended to still include both migration
49+
files by making the whole migration file consist of a comment.
50+
If your database does not support comments, then deleting the migration file will also work.
51+
Note, an actual empty file (e.g. a 0 byte file) may cause issues with your database since migrate
52+
will attempt to run an empty query. In this case, deleting the migration file will also work.
53+
For the rational of this behavior see:
54+
[#244 (comment)](https://github.com/golang-migrate/migrate/issues/244#issuecomment-510758270)
5055

5156
## Migration Content Format
5257

0 commit comments

Comments
 (0)