Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (18 sloc) 1.913 kb
538ba78a »
2011-08-03 Initial commit of iciql.
1 ## Database & Table Versioning
2
3 Iciql supports an optional, simple versioning mechanism. There are two parts to the mechanism.
4
5 1. You must supply an implementation of `com.iciql.DbUpgrader` to your `com.iciql.Db` instance.
3d1e36c3 »
2011-08-04 Overhauling annotations.
6 2. One or more of your table model classes must specify the `IQVersion(version)` annotation<br>
538ba78a »
2011-08-03 Initial commit of iciql.
7 AND/OR<br/>
3d1e36c3 »
2011-08-04 Overhauling annotations.
8 Your `com.iciql.DbUpgrader` implementation must specify the `IQVersion(version)` annotation
538ba78a »
2011-08-03 Initial commit of iciql.
9
10 ### How does it work?
0333ed4c »
2011-08-11 Added support for HSQL database. Revised dialects some more.
11 If you choose to use versioning, iciql will maintain a table within your database named *iq_versions* which is defined as:
538ba78a »
2011-08-03 Initial commit of iciql.
12
0333ed4c »
2011-08-11 Added support for HSQL database. Revised dialects some more.
13 CREATE TABLE IQ_VERSIONS(SCHEMANAME VARCHAR(255) NOT NULL, TABLENAME VARCHAR(255) NOT NULL, VERSION INT NOT NULL)
538ba78a »
2011-08-03 Initial commit of iciql.
14
15 This database table is automatically created if and only if at least one of your model classes specifies a *version* > 0.
16
0333ed4c »
2011-08-11 Added support for HSQL database. Revised dialects some more.
17 When you generate a statement, iciql will compare the annotated version field of your model class to its last known value in the *iq_versions* table. If *iq_versions* lags behind the model annotation, iciql will immediately call the registered `com.iciql.DbUpgrader` implementation before generating and executing the current statement.
538ba78a »
2011-08-03 Initial commit of iciql.
18
19 When an upgrade scenario is identified, the current version and the annotated version information is passed to either:
20
21 - `DbUpgrader.upgradeDatabase(db, fromVersion, toVersion)`
22 - `DbUpgrader.upgradeTable(db, schema, table, fromVersion, toVersion)`
23
0333ed4c »
2011-08-11 Added support for HSQL database. Revised dialects some more.
24 both of which allow for non-linear upgrades. If the upgrade method call is successful and returns *true*, iciql will update the *iq_versions* table with the annotated version number.
538ba78a »
2011-08-03 Initial commit of iciql.
25
26 The actual upgrade procedure is beyond the scope of iciql and is your responsibility to implement. This is simply a mechanism to automatically identify when an upgrade is necessary.
27
28 **NOTE:**<br/>
0333ed4c »
2011-08-11 Added support for HSQL database. Revised dialects some more.
29 The database entry of the *iq_versions* table is specified as SCHEMANAME='' and TABLENAME=''.
Something went wrong with that request. Please try again.