我想在mysql中创建db表,当部署spring引导应用程序到gcp。使用以下代码:
-
创建模式。SQL文件在资源文件夹
select 1 from dual;
-
创建学生。资源文件夹中的SQL文件
USE student; create table student ( ID INT AUTO_INCREMENT PRIMARY KEY, ENUMBER VARCHAR(50), FIRSTSUBMITDATE datetime, LASTSUBMITDATE datetime, TIMEZONE VARCHAR(50), SWCREATEDBY VARCHAR(50), SWMODIFYBY VARCHAR(50) );
-
application.property:
spring.datasource.platform=mysql spring.datasource.data=classpath:student.sql spring.datasource.initialization-mode=always
没有得到任何错误,也没有创建我的表
在properties中试试
spring.jpa.properties.javax.persistence.schema-generation.database.action=删除并创建spring.jpa.properties.javax.persistence.schema-generation.create-database-schemas = truespring.jpa.properties.javax.persistence.schema-generation.create-source =元数据