Search code examples
javaplayframeworkdatabase-migrationdatomicplayframework-evolutions

Play 2.0 Evolution for datomic


I am using Play 2.0 framework and Datomic for persistence. As of now, we usually install the database (and run migrations ) manually i.e. by reading schema from *.edn files from groovy script.

Now, I want to move my migration to 'Evolution', what could be the best possible way to do it? So all I want to know is:

  1. How to setup evolution for nosql databases (or persistence)
  2. How to write the scripts?
  3. How to run evolution for these databases?

Solution

  • I'm afraid it won't be possible to use evolutions through Datomic, they're meant to be used with JDBC/SQL (as evidenced by the source). That being said, It's possible in theory to achieve this if you were using an SQL database as the storage service for datomic (but from your question i gather that you're not).

    A solution/alternative could be to call your Groovy script (or do it in Java) from within Play's onStart method which can be overriden in Global.java (example here). Of course, you would have to do the checks to validate that the schema is up-to-date your self.