首页 > 解决方案 > Spring Boot 2.1 - 不能使用 hbm2ddl.auto 创建表

问题描述

我正在使用 Spring Boot 2.1.1 开始一个项目,我通常使用这个 application.properties 来创建或更新数据库表。我正在使用 MySQL 数据库

spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=update

有了这个属性,我可以用 Spring boot 1.5 更新模式,现在应用程序启动但没有更新。

我补充说,至于迁移指南,the spring.datasource.initialization-mode=always道具,但没有任何改变......

如果我选择createor create-drop,我会看到 Spring 尝试运行模式文件...所以问题出在update

标签: hibernatespring-boot

解决方案


推荐阅读