You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Runs migrations in transactions.
That means that if a migration fails, it will be safely rolled back.
Tries to return helpful error messages.
Stores migration version details in table schema_migrations.
This table will be auto-generated.
Safe to run concurrently (schema_migrations table is locked during migrations)
Migrations SQL formatting
Each SQL statement MUST end with semicolon (;) FOLLOWED BY NEWLINE !
Whole migration will be executed inside transaction by default.
Place SQL between "-- TXBEGIN" and "-- TXEND" comments for custom transaction:
you CAN have multiple separate transactions in single migration
any SQL not wrapped into TXBEGIN - TXEND will be executed without transaction.
Add "-- NOTX" comment above all SQL to disable default transaction. NOTE:
it's redundant when TXBEGIN/TXEND is used.
Usage
migrate -url mysql://user@tcp(host:port)/database -path ./db/migrations create add_field_to_table
migrate -url mysql://user@tcp(host:port)/database -path ./db/migrations up
migrate help# for more info