FlyWay无需迁移

时间:2017-10-13 11:39:17

标签: java flyway

我的java代码

        Flyway flyway = new Flyway();
        try {
            flyway.setDataSource(createDataSource());
            flyway.setTable(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_MIGRATION_TABLE_NAME));
            flyway.setBaselineVersionAsString(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_BASELINE_VERSION));
            flyway.setSqlMigrationSeparator(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_SEPARATOR));
            flyway.setSqlMigrationSuffix(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_SUFFIX));
            flyway.setSqlMigrationPrefix(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_PREFIX));
            flyway.setEncoding(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_ENCODING));
            flyway.setSchemas(FlyWayProperty.getInstance().getProperty(FlyWayProperty.ORACLE_DB_USERNAME));
            flyway.setLocations(FlyWayProperty.getInstance().getProperty(FlyWayProperty.FLYWAY_LOCATION));
            flyway.setValidateOnMigrate(true);
            flyway.migrate();
            flywayMigrateStop();
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }

属性

ORACLE_DB_DRIVER_CLASS=oracle.jdbc.driver.OracleDriver
ORACLE_DB_URL=jdbc:oracle:thin:@192.168.100.210:1521:DB
ORACLE_DB_USERNAME=FLYWAY_SCHEMA
ORACLE_DB_PASSWORD=FLYWAY_SCHEMA
FLYWAY_MIN_VERSION=V1
FLYWAY_MIGRATION_TABLE_NAME=SERVER_VERSION_DB
FLYWAY_BASELINE_VERSION=1.0.0
FLYWAY_ENCODING=UTF-8
FLYWAY_PREFIX=V
FLYWAY_SEPARATOR=__
FLYWAY_SUFFIX=.sql
FLYWAY_LOCATION=classpath:db/migration

日志

INFO: [2017-10-13 14:34:46.859 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.info(44)  - Database: jdbc:oracle:thin:@192.168.100.210:1521:DB (Oracle 11.2)
DEBUG: [2017-10-13 14:34:47.054 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - DDL Transactions Supported: false
DEBUG: [2017-10-13 14:34:47.055 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Schema: FLYWAY_SCHEMA
DEBUG: [2017-10-13 14:34:47.060 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Spring Jdbc available: false
DEBUG: [2017-10-13 14:34:47.062 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning for SQL callbacks ...
DEBUG: [2017-10-13 14:34:47.062 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning for classpath resources at 'classpath:db/migration' (Prefix: '', Suffix: '.sql')
DEBUG: [2017-10-13 14:34:47.063 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Determining location urls for classpath:db/migration using ClassLoader ModuleClassLoader for Module "deployment.mobile.bank.services-1.0.5.ear.flyway-1.0-SNAPSHOT.jar:main" from Service Module Loader ...
DEBUG: [2017-10-13 14:34:47.063 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning URL: vfs:/E:/Soft/Server_10.1.0/bin/content/mobile.bank.services-1.0.5.ear/flyway-1.0-SNAPSHOT.jar/db/migration/
DEBUG: [2017-10-13 14:34:47.063 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - JBoss VFS v2 available: false
DEBUG: [2017-10-13 14:34:47.064 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - JBoss VFS v3 available: true
DEBUG: [2017-10-13 14:34:47.065 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning starting at classpath root on JBoss VFS: E:\Soft\Server_10.1.0\bin\content\mobile.bank.services-1.0.5.ear\flyway-1.0-SNAPSHOT.jar\/
DEBUG: [2017-10-13 14:34:47.111 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Validating migrations ...
DEBUG: [2017-10-13 14:34:47.113 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning for classpath resources at 'classpath:db/migration' (Prefix: 'V', Suffix: '.sql')
DEBUG: [2017-10-13 14:34:47.113 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning URL: vfs:/E:/Soft/Server_10.1.0/bin/content/mobile.bank.services-1.0.5.ear/flyway-1.0-SNAPSHOT.jar/db/migration/
DEBUG: [2017-10-13 14:34:47.114 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - JBoss VFS v2 available: false
DEBUG: [2017-10-13 14:34:47.115 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning for classpath resources at 'classpath:db/migration' (Prefix: 'R', Suffix: '.sql')
DEBUG: [2017-10-13 14:34:47.115 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning URL: vfs:/E:/Soft/Server_10.1.0/bin/content/mobile.bank.services-1.0.5.ear/flyway-1.0-SNAPSHOT.jar/db/migration/
DEBUG: [2017-10-13 14:34:47.115 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - JBoss VFS v2 available: false
DEBUG: [2017-10-13 14:34:47.116 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning for classes at 'classpath:db/migration' (Implementing: 'org.flywaydb.core.api.migration.jdbc.JdbcMigration')
DEBUG: [2017-10-13 14:34:47.116 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Scanning URL: vfs:/E:/Soft/Server_10.1.0/bin/content/mobile.bank.services-1.0.5.ear/flyway-1.0-SNAPSHOT.jar/db/migration/
DEBUG: [2017-10-13 14:34:47.116 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - JBoss VFS v2 available: false
INFO: [2017-10-13 14:34:47.127 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.info(44)  - Successfully validated 0 migrations (execution time 00:00.014s)
DEBUG: [2017-10-13 14:34:47.134 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Schema "FLYWAY_SCHEMA" already exists. Skipping schema creation.
TRACE: [2017-10-13 14:34:47.169 MSK] org.apache.camel.impl.DefaultPackageScanClassResolver.<init>(71)  - Adding ContextClassLoader from current thread: ModuleClassLoader for Module "deployment.mobile.bank.services-1.0.5.ear.komplat.ejb-1.0-SNAPSHOT.jar:main" from Service Module Loader
DEBUG: [2017-10-13 14:34:47.196 MSK] org.apache.camel.impl.DefaultCamelContext.addRoutes(967)  - Adding routes from builder: Routes: []
DEBUG: [2017-10-13 14:34:47.209 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Locking table "FLYWAY_SCHEMA"."SERVER_VERSION_DB"...
DEBUG: [2017-10-13 14:34:47.215 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.debug(40)  - Lock acquired for table "FLYWAY_SCHEMA"."SERVER_VERSION_DB"
INFO: [2017-10-13 14:34:47.223 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.info(44)  - Current version of schema "FLYWAY_SCHEMA": << Empty Schema >>
INFO: [2017-10-13 14:34:47.225 MSK] org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog.info(44)  - Schema "FLYWAY_SCHEMA" is up to date. No migration necessary.

我的migartatoins文件的名称为V1__20170918_Initial_structure.sql

出于某种原因,它不能解决脚本的迁移问题。该表包含SERVER_VERSION_DB。但是一切都是值得的。可以不调用这些文件吗?

无法解析位置类路径:db / migration

我有fly.e.shar的server.ear

0 个答案:

没有答案