playframework 2.6+ DB evolutions that can manage sql script from multiple dependency libraries
- Install
// for play 2.8.x
libraryDependencies += "com.sandinh" %% "subfolder-evolutions" % "2.8.1"
// for play 2.7.x
libraryDependencies += "com.sandinh" %% "subfolder-evolutions_2.7" % "2.8.1"
// for play 2.8.x
libraryDependencies += "com.sandinh" %% "subfolder-evolutions_2.6" % "2.8.1"
- Each library should place evolutions scripts in folder
evolutions/<db-name>/<subfolder-name>
instead of place directly inevolutions/<db-name>
as in the plain evolutions.
Example: A library "sd" %% "pay" % "2.0.0"
has scripts evolutions/default/pay/{1.sql, 2.sql}
The library should have the following config in reference.conf
file:
evolutions.default.folders += pay
- In the main play application :
- add sbt libraryDependencies:
name := "bank"
libraryDependencies ++= Seq(
"com.sandinh" %% "subfolder-evolutions" % "2.8.1",
"sd" %% "pay" % "2.0.0"
)
-
(similar,) place evolutions scripts in
conf/evolutions/default/bank/{1.sql, 2.sql, 3.sql}
-
and add to
conf/application.conf
:
evolutions.default.folders += bank
play.modules.disabled += "play.api.db.evolutions.EvolutionsModule"
subfolder-evolutions
will magically do its job :D
- We use sbt-devops, so push tag
vM.N.P
=> auto build, test, publish versionM.N.P
- should add unit test
- MUST update [CHANGES.md]!
- MUST NOT publish manually
see CHANGES.md
This software is licensed under the Apache 2 license
Copyright (C) 2011-2021 Sân Đình (https://sandinh.com)