flyway - 为什么不能切换到新创建的架构?

时间:2017-09-06 13:20:03

标签: spring maven spring-boot flyway

我和flyway合作,看起来很有希望。所以,在根项目的pom.xml文件中,我有这个:

<plugin>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-maven-plugin</artifactId>
    <version>${flyway.version}</version>
    <configuration>
        <driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
        <url>jdbc:sqlserver://localhost</url>
        <user>sa</user>
        <password>dbPassword/</password>
        <schemas>
            <schema>schemaA</schema>
            <schema>schemaB</schema>
        </schemas>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>${mssql.version}</version>
        </dependency>
    </dependencies>
</plugin>

在projectA&project和&#39; pom.xml上,我有这个:

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
    <version>${flyway.version}</version>
</dependency>

此外,在每个项目application.properties上都有以下内容:

#flyway
flyway.baseline-description= #
flyway.baseline-version=1 # version to start migration
flyway.baseline-on-migrate= #
flyway.check-location=false # Check that migration scripts location exists.
flyway.clean-on-validation-error= #
flyway.enabled=true # Enable flyway.
#flyway.encoding= #
#flyway.ignore-failed-future-migration= #
#flyway.init-sqls= # SQL statements to execute to initialize a connection immediately after obtaining it.
flyway.locations=classpath:db/migration
#flyway.out-of-order= #
#flyway.placeholder-prefix= #
#flyway.placeholder-replacement= #
#flyway.placeholder-suffix= #
#flyway.placeholders.*= #
flyway.schemas=schemaX
#flyway.sql-migration-prefix=V #
#flyway.sql-migration-separator= #
#flyway.sql-migration-suffix=.sql #
flyway.table= #
flyway.url=jdbc:sqlserver://localhost
flyway.user=sa
flyway.password=dbPassword
flyway.validate-on-migrate= #

所以,为了让它成功,我在做什么:

  1. 使用用户sa和密码dbPassword在数据库上创建schemaA和schemaB。
  2. 在文件[projectA]/src/main/resources/db/migration/的位置V1_0_Initialize.sql放置,这会创建表格的结构并填充标准化数据。
  3. 尝试使用以下命令运行:mvn clean flyway:migrate -DskipTests
  4. 在第3步,我收到错误消息:

    [INFO] Current version of schema [dbo.schemaA]: null

    [INFO] Migrating schema [dbo.schemaA] to version 1.0 - Initialize

    以后几行:

    [ERROR] Message : The specified schema name "dbo.schemaA" either does not exist or you do not have permission to use it.

    如果我尝试使用DBMS导入脚本,一切都很完美。

    我没有看到什么?

    亲切的问候,

0 个答案:

没有答案
相关问题