无法迁移MySQL DB

时间:2012-11-28 17:10:28

标签: mysql database-migration flyway

我无法初始化然后使用命令行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文件,但我不明白为什么...... 有什么想法吗?

1 个答案:

答案 0 :(得分:0)

将您的迁移从mysql/global移至sql/mysql/global,您应该好好去。

我会考虑改进文档以使其更清晰。