I'm trying to migrate some SQL tables using the gradle script:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'gradle.plugin.com.boxfuse.client:flyway-release:4.0.3'
classpath group: 'org.postgresql', name: 'postgresql', version: '9.4.1208.jre7'
}
}
apply plugin: 'org.flywaydb.flyway'
flyway {
user = 'postgres'
url = 'jdbc:postgresql://localhost:5432/test'
driver = 'org.postgresql.Driver'
locations = ['filesystem:scripts']
}
And in the scripts directory I have just one SQL script:
CREATE TABLE place (
id VARCHAR(50) NOT NULL,
country VARCHAR(255),
country_code VARCHAR(255),
name VARCHAR(255),
PRIMARY KEY(id)
);
When I run gradle flywayMigrate -i
I get the output:
Database: jdbc:postgresql://localhost:5432/test (PostgreSQL 9.5)
Successfully validated 0 migrations (execution time 00:00.009s)
Current version of schema "public": << Empty Schema >>
Schema "public" is up to date. No migration necessary.
In the test database the schema_version table is created, but the table place is not.
The directory structure for flyway is:
flyway-dir
-- build.gradle
-- scripts/001-add_place_table.sql
Am I missing some additional settings for flyway? It's quite unfortunate the I don't get any error message.
It seems that you've that the migration script is named incorrectly. Please name the script appropriately - see Naming section.