Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1471

Integrate Flyway or Liquibase or something similar

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.13.0
    • Fix Version/s: 1.13.2
    • Component/s: Core
    • Labels:
      None

      Description

      from Kambiz:

      Hi,

      in our non-Isis projects, we use FlyWay [1] for DB migrations and I
      would like to integrate it into our Isis workflow. The simplest path to
      do so would be a DomainService with a PostConstruct annotated init
      method:

      @PostConstruct
      public void init(final Map<String, String> properties) {
      Flyway flyway = new Flyway();

      // Point it to the database
      String jdbcUrl = properties.get("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL");
      String user = properties.get("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName");
      String password = properties.get("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword");

      flyway.setDataSource(jdbcUrl, user, password);
      flyway.setLocations("classpath:db/migrations");
      // Start the migration
      flyway.migrate();
      }

      but this isn't a viable solution, as IsisSessionFactoryBuilder's
      buildSessionFactory() method initialises the DataNucleus (DN)
      PersistenceSessionFactory before the services are constructed [2].

      So DN has already found the mismatch between the JDO annotations and the
      database before we enter the init method of our DB migration
      bootstrap/seed service.

      I could contribute a patch, if someone could hint on the preferred way
      of implementing the functionality.

      Thank you

      Kambiz

      [1] https://flywaydb.org/

      [2] https://github.com/apache/isis/blob/master/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryBuilder.java#L184

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: