1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SpringBootでschema.sqlに書いた初期化用SQLが実行されない

Posted at

状況

schema.sqlの内容

--テーブル作成などのSQLを記述する用のファイル
CREATE TABLE IF NOT EXISTS tasklist (
     id   VARCHAR(8)  PRIMARY KEY,
     task VARCHAR(256),
     deadline VARCHAR(10),
     done BOOLEAN
 );

解決方法

application.propertiesの設定が間違ってました
どうやら参考にしていた学習書に記載されていた設定方式が古かったらしい、、
springboot2.5以降で記載形式が変わった模様

#修正前
spring.datasource.initialization-mode=always
#修正後
spring.sql.init.mode=always
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?