原版本是1.4.17,换成1.5.3后,运行jar包,出现:
2022-05-31 11:39:44.486 INFO 4776 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema
halodb_1to version "6 - migrate create contents table"
2022-05-31 11:39:44.499 ERROR 4776 --- [ main] o.f.core.internal.command.DbMigrate : Migration of schema
halodb_1` to version "6 - migrate create contents table" failed! Please restore backups and roll back database and code!
2022-05-31 11:39:44.521 INFO 4776 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-31 11:39:44.545 ERROR 4776 --- [ main] o.s.boot.SpringApplication : Application run failed
org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V6__migrate_create_contents_table.sql failed
SQL State : 23000
Error Code : 1062
Message : Duplicate entry '2' for key 'contents.PRIMARY'
Location : migration/V6migrate_create_contents_table.sql (/usr/local/halo/file:/usr/local/halo/halo-1.5.3.jar!/BOOT-INF/classes!/migration/V6migrate_create_contents_table.sql)
Line : 2
Statement : -- Migrate post content to contents table
INSERT INTO contents(post_id, status, patch_log_id, head_patch_log_id, content, original_content, create_time,
update_time)
SELECT id,
status,
id,
id,
format_content,
original_content,
create_time,
update_time
FROM posts
at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:378) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:271) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:66) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:270) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:243) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:141) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:60) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(MySQLConnection.java:154) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:141) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:141) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:101) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.Flyway$1.execute(Flyway.java:219) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.Flyway$1.execute(Flyway.java:170) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.Flyway.execute(Flyway.java:586) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.Flyway.migrate(Flyway.java:170) ~[flyway-core-7.15.0.jar!/:na]
at run.halo.app.listener.StartedListener.migrate(StartedListener.java:123) ~[classes!/:1.5.3]
at run.halo.app.listener.StartedListener.onApplicationEvent(StartedListener.java:76) ~[classes!/:1.5.3]
at run.halo.app.listener.StartedListener.onApplicationEvent(StartedListener.java:47) ~[classes!/:1.5.3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.18.jar!/:5.3.18]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.18.jar!/:5.3.18]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.18.jar!/:5.3.18]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.18.jar!/:5.3.18]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.18.jar!/:5.3.18]
at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:105) ~[spring-boot-2.5.12.jar!/:2.5.12]
at org.springframework.boot.SpringApplicationRunListeners.lambda$started$5(SpringApplicationRunListeners.java:75) ~[spring-boot-2.5.12.jar!/:2.5.12]
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507) ~[na:na]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.5.12.jar!/:2.5.12]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.5.12.jar!/:2.5.12]
at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:75) ~[spring-boot-2.5.12.jar!/:2.5.12]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:345) ~[spring-boot-2.5.12.jar!/:2.5.12]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365) ~[spring-boot-2.5.12.jar!/:2.5.12]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-2.5.12.jar!/:2.5.12]
at run.halo.app.Application.main(Application.java:21) ~[classes!/:1.5.3]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[halo-1.5.3.jar:1.5.3]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[halo-1.5.3.jar:1.5.3]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[halo-1.5.3.jar:1.5.3]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[halo-1.5.3.jar:1.5.3]
Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Migration V6__migrate_create_contents_table.sql failed
SQL State : 23000
Error Code : 1062
Message : Duplicate entry '2' for key 'contents.PRIMARY'
Location : migration/V6migrate_create_contents_table.sql (/usr/local/halo/file:/usr/local/halo/halo-1.5.3.jar!/BOOT-INF/classes!/migration/V6migrate_create_contents_table.sql)
Line : 2
Statement : -- Migrate post content to contents table
INSERT INTO contents(post_id, status, patch_log_id, head_patch_log_id, content, original_content, create_time,
update_time)
SELECT id,
status,
id,
id,
format_content,
original_content,
create_time,
update_time
FROM posts
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:277) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:224) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:128) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:78) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:67) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:66) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:370) ~[flyway-core-7.15.0.jar!/:na]
... 40 common frames omitted
Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'contents.PRIMARY'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117) ~[mysql-connector-java-8.0.28.jar!/:8.0.28]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.28.jar!/:8.0.28]
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:763) ~[mysql-connector-java-8.0.28.jar!/:8.0.28]
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) ~[mysql-connector-java-8.0.28.jar!/:8.0.28]
at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:241) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:111) ~[flyway-core-7.15.0.jar!/:na]
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:212) ~[flyway-core-7.15.0.jar!/:na]
... 46 common frames omitted
2022-05-31 11:39:44.559 INFO 4776 --- [ main] o.e.jetty.server.AbstractConnector : Stopped ServerConnector@29ef6856{HTTP/1.1, (http/1.1)}{0.0.0.0:8090}
2022-05-31 11:39:44.560 INFO 4776 --- [ main] org.eclipse.jetty.server.session : node0 Stopped scavenging
2022-05-31 11:39:44.561 INFO 4776 --- [ main] o.e.j.s.h.ContextHandler.application : Destroying Spring FrameworkServlet 'dispatcherServlet'
2022-05-31 11:39:44.562 INFO 4776 --- [ main] o.e.jetty.server.handler.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@5b332439{application,/,[file:///tmp/jetty-docbase.8090.15184187017743554723/, jar:file:/usr/local/halo/halo-1.5.3.jar!/BOOT-INF/lib/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],STOPPED}
2022-05-31 11:39:44.595 INFO 4776 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-05-31 11:39:44.597 INFO 4776 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-05-31 11:39:44.606 INFO 4776 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
`
查询先关后,好像是mysql数据库有问题,问下,1.4的mysql库和1.5的mysql库是有差异了吗?如何解决下