|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.extensions.migration.ERXMigration
public abstract class ERXMigration
Convenience superclass for Migration classes. Checks for corresponding sql files name "ClassnameX_Upgrade.migration" and "ClassnameX_Downgrade.migration" where "Classname" is the classname of the migration class. The files have to to be in a corresponding bundle. Implement "migrationBundleName" to return the correct name of the bundle.
This makes migrations easier as you only have to create a new Java class according to the migration naming conventions, inherit from this class and put your SQL in a properly named text file (or more than one file, if you use database specific migrations).
If you need database specific migrations use
er.extensions.migration.ERXMigration.useDatabaseSpecificMigrations=true
in your Properties. The default is not to use database specific migrations. A filename for a database specific migration is then for example
ClassnameX_FrontBase_Upgrade.migration
or
ClassnameX_Postgresql_Upgrade.migration
For the database specific part of the filename, the databaseProductName as from the JDBC adaptor is used. So make sure, you're using the correct filename. The migration will throw an exception if the appropriate migration textfile can't be found.
Constructor Summary | |
---|---|
ERXMigration()
|
|
ERXMigration(boolean useDatabaseSpecificMigrations)
Override the global application preference on per-database migrations. |
Method Summary | |
---|---|
void |
downgrade(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.eoaccess.EOAdaptorChannel channel,
com.webobjects.eoaccess.EOModel model)
Checks for a corresponding downgrade file which is performed as a raw SQL action |
protected java.lang.String |
getSQLForMigration(java.lang.String migrationName)
Checks in the current bundle for migration files corresponding to this classes name |
protected java.lang.String |
migrationBundleName()
The name to create the NSBundle for the current bundle, defaults to the bundle that contains the migration class. |
com.webobjects.foundation.NSArray<ERXModelVersion> |
modelDependencies()
No dependencies |
void |
upgrade(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.eoaccess.EOAdaptorChannel channel,
com.webobjects.eoaccess.EOModel model)
Checks for a corresponding upgrade file which is performed as a raw SQL action |
protected boolean |
useDatabaseSpecificMigrations()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ERXMigration(boolean useDatabaseSpecificMigrations)
useDatabaseSpecificMigrations
- if true, database-specific migrations will be usedpublic ERXMigration()
Method Detail |
---|
public com.webobjects.foundation.NSArray<ERXModelVersion> modelDependencies()
modelDependencies
in interface IERXMigration
public void downgrade(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOModel model) throws java.lang.Throwable
downgrade
in interface IERXMigration
editingContext
- the editing context you can perform EO operations with.channel
- the channel to perform low level operations withmodel
- the model being downgraded
java.lang.Throwable
- if something failspublic void upgrade(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOModel model) throws java.lang.Throwable
upgrade
in interface IERXMigration
editingContext
- the editing context you can perform EO operations with.channel
- the channel to perform low level operations withmodel
- the model being upgraded
java.lang.Throwable
- if something failsprotected java.lang.String getSQLForMigration(java.lang.String migrationName)
migrationName
- protected java.lang.String migrationBundleName()
protected boolean useDatabaseSpecificMigrations()
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |