我正在尝试使用gradle脚本迁移一些SQL表:
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']
}
在脚本目录中,我只有一个SQL脚本:
CREATE TABLE place (
id VARCHAR(50) NOT NULL,
country VARCHAR(255),
country_code VARCHAR(255),
name VARCHAR(255),
PRIMARY KEY(id)
);
当我运行gradle flywayMigrate -i
时,我得到了输出:
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.
在测试数据库中创建了 schema_version 表,但 表不是。
flyway的目录结构是:
flyway-dir
-- build.gradle
-- scripts/001-add_place_table.sql
我是否错过了一些飞路的其他设置?非常不幸的是我没有收到任何错误信息。