mysql - Spring Boot - MySQL 默认使用 InnoDB
问题描述
我想用 InnoDB 创建我的数据库表,我使用的是 Spring Boot 2.1.3 和 MySQL 8.0,所以我使用了这个:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
而且,是的,它有效,但我的控制台中有很多错误:
2019-04-03 19:11:55.182 INFO 1820 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2019-04-03 19:11:55.966 WARN 1820 --- [ restartedMain] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : Error executing DDL "alter table application drop foreign key FKldca8xj6lqb3rsqawrowmkqbg" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table application drop foreign key FKldca8xj6lqb3rsqawrowmkqbg" via JDBC Statement
我的每张桌子都有这个:
Caused by: java.sql.SQLSyntaxErrorException: Table 'test.usr' doesn't exist
“test.usr” -> “test” 是我的模式名称,“usr” 是表名。
但它仍然会创建我所有的表,所以我怎样才能摆脱这个错误?
解决方案
正如 Antoniossss 所提议的,我刚刚使用 Flyway 来处理我的数据库。谢谢。
推荐阅读
- javascript - 如何使用正则表达式找到重复的字符对?
- c++ - ncurses 是否可以将字段 form.h 添加到面板 panel.h?
- c++ - 为什么使用 Eigen 密集动态矩阵的 setZero 比静态矩阵更快?
- python - 如何增加分组条之间的间距
- python - 我需要结合使用 SQLAlchemy 和 Graphene 编写查询
- ios - RCTEventEmitter 未发出事件以响应本机
- actionscript-3 - 带有滚动事件处理程序的基于 mx 或 spark 的滚动器的示例
- javascript - 使用带有和溢出的网格时如何防止出现整体滚动条
- node.js - 使用 React 从快速服务器的自定义 URL 获取数据
- android - 如何在同一活动上飞溅 gif 几秒钟