Versioned migrations
The most common type of migration is a versioned migration. Each versioned migration has a unique version and is
applied exactly once.
Usages
- Creating/altering/dropping tables/indexes/foreign keys/enums/UDTs/...
- Reference data updates
- User data corrections
Versions
Each versioned migration must have a unique version and a description.
A version must have the following structure:
- One or more numeric parts
- Separated by a dot (.) or an underscore (_)
- Underscores are replaced by dots at runtime
- Leading zeroes are ignored in each part
Examples of valid versions:
- 1
- 001
- 5.2
- 5_2 (5.2 at runtime)
- 1.2.3.4.5.6.7.8.9
- 205.68
- 20130115113556
- 2013.1.15.11.35.56
- 2013.01.15.11.35.56
Example
V1__Cars.sql
CREATE TABLE cars (
id INT NOT NULL PRIMARY KEY,
license_plate VARCHAR NOT NULL,
color VARCHAR NOT NULL
);
Repeatable migrations