playframework 2.1 - Place Play Framework 2.1 database evolutions in sub project? -


i have play framework 2.1 application, , database code located in sub project — in case want support more 1 kind of backend in future, e.g. file based database or cassandra.

currently, however, database relational database , i'd use play's database evolutions mechanism. don't know how, or if possible, place evolutions script in sub project (where belong), rather in main project. — if place them in sup project, play apparently ignores them. question: can place evolutions script in sub project, , how do it?

edit october 2015: use flywaydb instead of play's built-in evolutions, since year or so. heartily recommend flywaydb. can evolutions in sub projects flywaydb in way want, , need write code starts evolutions yourself. /edit


this i've tried far:

  1. create sub project, ./modules/evolutions-test/

  2. in sub project, create evolutions script:
    ./modules/evolutions-test/conf/evolutions/default/1.sql

  3. don't configure database connection info in sub project — apparently, settings ignored (?). configure connection info in main project config file instead, e.g.:

    db.default.driver=org.postgresql.driver db.default.url="jdbc:postgresql://192.168.0.123/test_evolutions" db.default.user=test_evolutions db.default.password=... 
  4. include jdbc , postgresql driver dependencies of sub project.

  5. have main project depend on sub project.
    (and hit reload in play's console.)

this didn't make play realize there evolutions script apply in sub project. instead, play finds , uses evolutions script located in main projects conf directory. suppose softlink main project sub project, , in manner still keep contents of evolution scripts in sub project.

(i've answered own question below, because might post once i've written question — , ought useful other people? shouldn't many people consider placing database code in sub module?)

it's not possible? see:
https://groups.google.com/d/msg/play-framework/548juznjste/x1hbxyc7pqwj
discussion how can "fixed" somehow.

instead, softlink from
<main-project>/conf/evolutions/default
to
<main-project>/modules/evolutions-test-project/conf/evolutions/default


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -