我无法使用命令行 2.0.2 初始化然后迁移 MyQSL 数据库,这是我的配置文件:
root# cat conf/global.properties
flyway.driver=com.mysql.jdbc.Driver
flyway.url=jdbc:mysql://localhost:3306/global
flyway.user=root
flyway.password=password
flyway.schemas=global
flyway.sqlMigrationPrefix=GLOBAL
flyway.locations=mysql/global
flyway.initialVersion=3.5.1.3.0
这是我的 SQL 脚本目录的内容:
root# ls -1 mysql/global/
GLOBAL3.5.1.1.0_a__update_table.sql
GLOBAL3.5.1.2.0_a__add_column1.sql
GLOBAL3.5.1.3.0_a__add_column2.sql
GLOBAL3.6.0.0.0_a__add_table.sql
这是 ./flyway.sh -X info 的结果(顺便说一下,几乎找不到这种调试模式):
root# ./flyway.sh -configFile=conf/global.properties info
Flyway (Command-line Tool) v.2.0.2
DEBUG: Adding location to classpath: PATH_TO_BIN/../jars/mysql-connector-java-5.1.18-bin.jar
DEBUG: Database: MySQL 5.1
DEBUG: DDL Transactions Supported: false
DEBUG: Schema: global
DEBUG: No metadata table upgrade to the Flyway 2.0 format necessary
DEBUG: No metadata table upgrade to the Flyway 2.0.2 format necessary
DEBUG: Spring Jdbc available: true
DEBUG: Scanning for resources at 'db/migration' (Prefix: 'GLOBAL', Suffix: '.sql')
DEBUG: Unable to determine URL for classpath location: db/migration (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for classes at 'db/migration' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration')
DEBUG: Unable to determine URL for classpath location: db/migration (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for classes at 'db/migration' (Implementing: 'com.googlecode.flyway.core.api.migration.spring.SpringJdbcMigration')
DEBUG: Unable to determine URL for classpath location: db/migration (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for classes at 'db/migration' (Implementing: 'com.googlecode.flyway.core.migration.java.JavaMigration')
DEBUG: Unable to determine URL for classpath location: db/migration (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for resources at 'mysql/global' (Prefix: 'GLOBAL', Suffix: '.sql')
DEBUG: Unable to determine URL for classpath location: mysql/global (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for classes at 'mysql/global' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration')
DEBUG: Unable to determine URL for classpath location: mysql/global (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for classes at 'mysql/global' (Implementing: 'com.googlecode.flyway.core.api.migration.spring.SpringJdbcMigration')
DEBUG: Unable to determine URL for classpath location: mysql/global (ClassLoader: java.net.URLClassLoader@1b17a8bd)
DEBUG: Scanning for classes at 'mysql/global' (Implementing: 'com.googlecode.flyway.core.migration.java.JavaMigration')
DEBUG: Unable to determine URL for classpath location: mysql/global (ClassLoader: java.net.URLClassLoader@1b17a8bd)
+-------------+------------------------+---------------------+---------+
| Version | Description | Installed on | State |
+-------------+------------------------+---------------------+---------+
| 3.5.1.3.0 | << Flyway Init >> | 2012-11-28 17:52:24 | Future |
+-------------+------------------------+---------------------+---------+
我不确定了解“未来”状态,我认为 flyway 找不到任何 SQL 文件,但我不明白为什么......知道吗?