DB Initialization: Release 1.0.0-RC3

DB Initialization: Release 1.0.0-RC3

Important feature Database Initialization added: Release of 1.0.0-RC3 which can be downloaded on the download page.

When living continuous integration and continuous delivery, it is vital that things like database migrations and initialization are performed in a controlled, but automatic way.

A Strolch-based application is using the PostgreSQL persistence layer. The implementation understands the concepts of migration, and validating the database schema, but currently a mechanism to automatically initialize the database with a minimal set of data was missing.

Migrating a database for Strolch is mostly a one time thing. The object model in Strolch is quite static, so there is seldom a need to migrate the database. Domain specific changes, i.e. new Resources, or adding Parameters to Resources, is not a schema change. Thus, instead of going the way other frameworks go, e.g. Ruby on Rails, we built the data initialization right into the PersistenceHandler.

Now if the PostgreSQL PersistenceHandler creates the schema, then it might also initialize the minimal set of data. For this to work, the PersistenceHandler checks if the flags allowSchemaCreation, allowSchemaDrop and allowDbInitOnSchemaCreate. If those flags are enabled, and the schema was created during initialization, then the database is also initialized with the contents of the XML file configured under key dataStoreFile of the relevant Realm.

The database initialization is done as a system user action which must have the name db_initializer. This is another fail-safe, so that on a production system, this user can simply be deleted.

So, Strolch 1.0.0-RC3 is out the door, go ahead and try it out.