Flyway mysqldump脚本失败

时间:2013-04-16 15:13:59

标签: mysql mysqldump flyway

一些更新

我有一个sql脚本迁移,如果我将它传输到mysql,但不会通过flyway运行。该脚本正在执行,但第一行显然是错误的。

一旦遇到这样的任何一行: / *!50003 SET character_set_results = latin1 * /;

脚本默默地停止运行。我使用了简单的insert语句来确保脚本至少已经启动,而且它是。

我不是试图针对不同类型的数据库或任何东西运行mysql语句。我的pom.xml是:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.cpt.migrations</groupId>
  <artifactId>cpt_migrations</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>cpt_migrations</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.24</version>
    </dependency>
  </dependencies>
  <build>
      <plugins>
          <plugin>
              <groupId>com.googlecode.flyway</groupId>
              <artifactId>flyway-maven-plugin</artifactId>
              <version>2.1.1</version>
              <configuration>
                  <user>root</user>
                  <password></password>
                  <driver>com.mysql.jdbc.Driver</driver>
                  <url>jdbc:mysql://localhost:3306/cpt</url>
              </configuration>
          </plugin>
      </plugins>
  </build>
</project>

运行: mvn clean compile flyway:clean flyway:migrate --debug --offline -ff -e

仅限第二次迁移:

[DEBUG] Locking table `cpt`.`schema_version`...
[DEBUG] Lock acquired for table `cpt`.`schema_version`
[INFO] Migrating schema `cpt` to version 2
[DEBUG] Successfully completed and committed migration of schema `cpt` to version 2
[DEBUG] Finished migrating schema `cpt` to version 2 (execution time 00:00.003s)
[DEBUG] MetaData table `cpt`.`schema_version` successfully updated to reflect changes
[DEBUG] Unlocking table `cpt`.`schema_version`...
[DEBUG] Lock released for table `cpt`.`schema_version`
[DEBUG] Locking table `cpt`.`schema_version`...
[DEBUG] Lock acquired for table `cpt`.`schema_version`
[DEBUG] Unlocking table `cpt`.`schema_version`...
[DEBUG] Lock released for table `cpt`.`schema_version`

如果我立即执行此操作:

cat target/classes/db/migration/V2__Triggers.sql | mysql -u root cpt 

更改按预期进行。

有关这里发生了什么的任何建议?看起来它应该只是将这个sql直接扔到数据库而不试图解析它,但显然情况并非如此。

此外,轻松同样重要。为什么我没有收到失败消息?

1 个答案:

答案 0 :(得分:0)

听起来你解决了解析器的问题。请在问题跟踪器中提交一个问题,其中一小部分示例迁移失败,我将尝试及时解决2.2。

相关问题