Sql migrations reside on the classpath or on the file system in one or more directories referenced by the locations property.
Unprefixed locations or locations with the classpath:
prefix target the classpath.
Locations with the filesystem:
prefix target the file system.
New sql migrations are discovered automatically through classpath and file system scanning at runtime.
This scanning is recursive. All migrations in directories below the specified ones are also picked up.
In order to be picked by the classpath scanner, the sql migrations must follow a naming pattern:
The file name consists of:
V
for versioned migrations, R
for repeatable migrations__
(two underscores).sql
Flyway supports placeholder replacement with configurable pre- and suffixes. By default it looks for Ant-style placeholders like ${myplaceholder}.
This can be very useful to abstract differences between environments.
/* Single line comment */ CREATE TABLE test_user ( name VARCHAR(25) NOT NULL, PRIMARY KEY(name) ); /* Multi-line comment */ -- Placeholder INSERT INTO ${tableName} (name) VALUES ('Mr. T');