As Business Applications adopting cloud-integration platforms and increasingly embracing SaaS model, there is a growing need of discovering the structure of incoming objects , extract metadata, create schema and persist them instantly – without ever halting the data-acquisition-process for identifying target data stores, provisioning schema !   The whole process need to be done on-the-fly !

A. Leverage NoSQL API to dynamically discover and create schema in App layer

That’s where MongoDB and Hbase play a crucial role in creating and altering schema dynamically based on the structure of incoming objects. Its a crucial design methodology as the same type of Entity can hold different types of attributes for different Tenants. That’s why the concept of co-located embedded documents , auto-shardable collection, column-family row-keys gaining popularity. By implementing versions inside schema definition, one can easily roll back changes.

B. For RDBMS users ; there are few interesting options like 1. QueryDSL ,  2. JOOQ 

One can also combine QueryDSL / JOOQ with  ‘Spring SimpleJdbcCommand’  and also leverage a powerful pojo-driven schema management utility – ‘spring-liquibase module’

Recently got a chance to build a pojo-driven schema management framework using the following conceptual flow : You can do wonders by combining spring-rest and spring-liquibase modules

Let me quote the Liquibase feature-set :

You never develop code without version control, why do you develop your database without it?

Liquibase is an open source (Apache 2.0 Licensed), database-independent library for tracking, managing and applying database changes. It is built on a simple premise:   All database changes are stored in a human readable yet trackable form and checked into source control.

Liquibase Supports:

  • Extensibility
  • Merging changes from multiple developers
  • Code branches
  • Multiple Databases
  • Managing production data as well as various test datasets
  • Cluster-safe database upgrades
  • Automated updates or generation of SQL scripts that can be approved and applied by a DBA
  • Update rollbacks
  • Database ”diff“s
  • Generating starting change logs from existing databases
  • Generating database change documentation