文章目录
Flyway Setting and Table Info
1. Dependencies
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
2. Configuration
flyway:
enabled: true
baseline-on-migrate: true
<!-- Spring Datasource -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${idm.persistence.connection.driver.class}" />
<property name="jdbcUrl" value="${idm.persistence.connection.url}" />
<property name="user" value="${idm.persistence.connection.username}" />
<property name="password" value="${idm.persistence.connection.password}" />
</bean>
# Database connection settings
idm.persistence.connection.driver.class = org.postgresql.Driver
# Update this url to have your correct information
idm.persistence.connection.url = @pg.url@
# Database connection user settings
idm.persistence.connection.username = @pg.user@
idm.persistence.connection.password = @pg.password@
<profiles>
<profile>
<id>env-my</id>
<activation>
<property>
<name>env</name>
<value>local</value>
</property>
</activation>
<properties>
<redis.host>192.168.99.100</redis.host>
<redis.port>6379</redis.port>
<redirect.uris>https://localhost:3000/auth_code/callback</redirect.uris>
<register.server>192.168.99.100:8848</register.server>
<api.gateway.register.ip>127.0.0.1</api.gateway.register.ip>
<idm.host>localhost:8088</idm.host>
<idm.real.ip>localhost</idm.real.ip>
<demo.resserver.domainorip>localhost</demo.resserver.domainorip>
<pg.url>jdbc:postgresql://204.104.116.128:5432/idmprod_20190927</pg.url>
<pg.user>postgres</pg.user>
<pg.password>postgres</pg.password>
<dxcuser.domain>VPC_INT</dxcuser.domain>
<accesstoken.uri>https://localhost:8088/oauth/token</accesstoken.uri>
<user.authorization.uri>https://localhost:8088/oauth/authorize</user.authorization.uri>
<userinfo.uri>https://localhost:8088/user</userinfo.uri>
<tokenidm.uri>https://aaaaa-apigw-vip.ft1core.mcloud.entsvcs.net:5001/v3</tokenidm.uri>
<auth.server.port>8088</auth.server.port>
<env>local</env>
</properties>
</profile>
3. Table Name flyway_schema_history
4. Log
2020-03-09 17:40:33.884 INFO 20184 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 5.2.4 by Boxfuse
2020-03-09 17:40:33.896 INFO 20184 --- [ main] o.f.c.internal.database.DatabaseFactory : Database: jdbc:postgresql://204.104.116.128:5432/idmprod_20190927 (PostgreSQL 9.5)
2020-03-09 17:40:37.837 INFO 20184 --- [ main] o.f.core.internal.command.DbValidate : Successfully validated 2 migrations (execution time 00:01.123s)
2020-03-09 17:40:39.795 INFO 20184 --- [ main] o.f.c.i.s.JdbcTableSchemaHistory : Creating Schema History table: "public"."flyway_schema_history"
2020-03-09 17:40:46.945 INFO 20184 --- [ main] o.f.core.internal.command.DbBaseline : Successfully baselined schema with version: 1
2020-03-09 17:40:48.969 INFO 20184 --- [ main] o.f.core.internal.command.DbMigrate : Current version of schema "public": 1
2020-03-09 17:40:48.970 INFO 20184 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version 2 - create
2020-03-09 17:40:55.034 INFO 20184 --- [ main] o.f.core.internal.command.DbMigrate : Successfully applied 1 migration to schema "public" (execution time 00:08.085s)
Error
2020-03-11 14:09:46.261 WARN 11976 — [ main] o.f.c.i.s.JdbcTableSchemaHistory : Could not find schema history table “public”.“flyway_schema_history”, but found “public”.“schema_version” instead. You are seeing this message because Flyway changed its default for flyway.table in version 5.0.0 to flyway_schema_history and you are still relying on the old default (schema_version). Set flyway.table=schema_version in your configuration to fix this. This fallback mechanism will be removed in Flyway 6.0.0.
Delete old table “schema_version” to fix the problem.