06.18.06
Designing Java migration scripts for SQL/Hibernate/Java Persistence API data
Every web application needs to load initial data into its production database (settings and domain specific data such as available categories, etc..).
Another concern is the migration of current data to the new schema. Hibernate/JPA makes it easy to create additional fields, but as soon as data migration is needed, it is necessary to have something more robust.
That is my current concern : I want to create a decent import/migration system.
Requirements :
- Versioning : Launching a migration should detect the current state of the database without breaking things if the data is up to date
- Heterogeneity-friendly : Some data come from XML, others are plain SQL scripts, some are calculated…. So, the importer system should play well with many kinds of sub-importers.
- Transaction-enabled : if an importer crashes, it must leave the data in the previous state
- Developer-friendly and extensible : it should be easy to add new importers for additional sets of data
I am still unsure about how I should do things, so if anyone has already worked on something similar, I am open to ideas.
In any case, once I work out something nice, I’ll re-post