版本中无效字符的 Flyway 异常
Flyway Exception for invalid characters in the version
出于学习目的,我正在尝试将 Flyway 与我的简单 maven 项目集成。
我正在使用以下插件和配置:
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>4.0.3</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
</dependencies>
<configuration>
<url>jdbc:mysql://${database.host}:${database.port}/${database.schema}?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8</url>
<user>${database.user}</user>
<password>${database.password}</password>
<sqlMigrationPrefix>V_</sqlMigrationPrefix>
<sqlMigrationSeparator>__</sqlMigrationSeparator>
<locations>
<location>filesystem:src/main/resources/db/migrations</location>
</locations>
</configuration>
</plugin>
这是我的示例迁移的名称 sql:
V_1__create_new_table.sql
我不确定我做错了什么,但我不断收到以下异常:
org.flywaydb.core.api.FlywayException: Invalid version containing non-numeric characters. Only 0..9 and . are allowed. Invalid version: V.1
我确实提到了以下问题,正如您在配置中看到的那样,我已经完成了要求的内容:
您可以尝试仅定义 V
作为您的迁移前缀,并将您的迁移文件命名为 V1__Create_New_Table.sql
(这些是 Flyway 默认值)。
您将 V_
定义为前缀并将 V_1__Create_New_Table.sql
定义为文件名的方式是造成问题的原因,因为这告诉 Flyway 此迁移的版本是 V.1
,它当然是不正确的。
对于较少数量的版本,您可以选择这样的方法:V1_1__Create_New_Table.sql
例如,这将为您提供 1.1
的迁移版本。
在您提供的相关 SO 答案中,建议的答案是使用 V_
作为前缀,使用 _
作为分隔符,而您在插件配置中定义了 __
作为插件分隔符。
出于学习目的,我正在尝试将 Flyway 与我的简单 maven 项目集成。
我正在使用以下插件和配置:
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>4.0.3</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
</dependencies>
<configuration>
<url>jdbc:mysql://${database.host}:${database.port}/${database.schema}?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8</url>
<user>${database.user}</user>
<password>${database.password}</password>
<sqlMigrationPrefix>V_</sqlMigrationPrefix>
<sqlMigrationSeparator>__</sqlMigrationSeparator>
<locations>
<location>filesystem:src/main/resources/db/migrations</location>
</locations>
</configuration>
</plugin>
这是我的示例迁移的名称 sql:
V_1__create_new_table.sql
我不确定我做错了什么,但我不断收到以下异常:
org.flywaydb.core.api.FlywayException: Invalid version containing non-numeric characters. Only 0..9 and . are allowed. Invalid version: V.1
我确实提到了以下问题,正如您在配置中看到的那样,我已经完成了要求的内容:
您可以尝试仅定义 V
作为您的迁移前缀,并将您的迁移文件命名为 V1__Create_New_Table.sql
(这些是 Flyway 默认值)。
您将 V_
定义为前缀并将 V_1__Create_New_Table.sql
定义为文件名的方式是造成问题的原因,因为这告诉 Flyway 此迁移的版本是 V.1
,它当然是不正确的。
对于较少数量的版本,您可以选择这样的方法:V1_1__Create_New_Table.sql
例如,这将为您提供 1.1
的迁移版本。
在您提供的相关 SO 答案中,建议的答案是使用 V_
作为前缀,使用 _
作为分隔符,而您在插件配置中定义了 __
作为插件分隔符。