0
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?

More than 3 years have passed since last update.

HerokuでSpring + PostgreSQLでflywayを動かす時に困った

Posted at

2時間くらい溶かしてしまったので備忘録に

問題

herokuのpostgresqlのコンソールにはURLが
postgres://[username]:[password]@[host]:[port]/[database name]
という形で書かれており、環境変数のDATABASE_URLにもこの形で格納される。
これをこのままapplication.propertiesに
spring.datasource.url=${DATABASE_URL}
と入れても起動のタイミングでflywayがエラーを出してしまった。

答え

これ
元々のURLを元にDATABASE_URLを
jdbc:postgresql://<host>:<port>/<dbname>?user=<username>&password=<password>
と書き換えてあげるとよい。
DATABASE_URLは書き換える際にはdetachする必要があるので注意。(detachしないとエラーが出て書き換えられない)

0
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
0
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?