Project Wonder 5.0

er.extensions.migration
Interface IERXMigration

All Known Subinterfaces:
IERXPostMigration
All Known Implementing Classes:
BugTracker0, BugTracker1, ERAttachment0, ERAttachment1, ERAttachmentMigration, ERCoreBusinessLogic0, ERTaggable0, ERTaggableEntity0, ERXMigration, ERXMigrationDatabase.Migration

public interface IERXMigration

IERXMigration is the interface that you must implemnt to provide a migration from one version to another. You should not saveChanges() on the editingcontext passed into the methods of this interface (unless it cannot be avoided), because there is a transaction above you. You also must be very careful of the EO operations you perform with this editing context. You may be in the process of upgrading across multiple model versions, so it is possible that you model you are using may be out of sync with the underlying database at the time this particular migration is being performed in the sequence. For instance, you would always be running with the latest version model, but this might be migration 3 of 5 required to get your database in sync with this latest model version, so the transitional model that existed when version 3 was valid may no longer exist. In general, you should only do low level channel operations during migration. Though, the editing context is provided here as a convenience for use under controlled circumstances if you know it will not be a problem. You can use the IERXPostMigration interface if you need to execute (in a restricted way) EO operations.

Author:
mschrag

Method Summary
 void downgrade(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOModel model)
          Called when migrating the database from the next version to this version.
 com.webobjects.foundation.NSArray<ERXModelVersion> modelDependencies()
          Returns an array of ModelVersion objects that this migration depends on.
 void upgrade(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOModel model)
          Called when migrating the database from the last version to this version.
 

Method Detail

modelDependencies

com.webobjects.foundation.NSArray<ERXModelVersion> modelDependencies()
Returns an array of ModelVersion objects that this migration depends on.

Returns:
an array of model versions that this migration depends on

upgrade

void upgrade(com.webobjects.eocontrol.EOEditingContext editingContext,
             com.webobjects.eoaccess.EOAdaptorChannel channel,
             com.webobjects.eoaccess.EOModel model)
             throws java.lang.Throwable
Called when migrating the database from the last version to this version. For instance if this is AuthModel1, it will be called to migrate from version 0 to version 1.

Parameters:
editingContext - the editing context you can perform EO operations with.
channel - the channel to perform low level operations with
model - the model being upgraded
Throws:
java.lang.Throwable - if something fails

downgrade

void downgrade(com.webobjects.eocontrol.EOEditingContext editingContext,
               com.webobjects.eoaccess.EOAdaptorChannel channel,
               com.webobjects.eoaccess.EOModel model)
               throws java.lang.Throwable
Called when migrating the database from the next version to this version. For instance if this is AuthModel1, it will be called to migrate from version 1 back to version 0. If this is the lowest migration you support, downgrade should throw an ERXMigrationFailedException.

Parameters:
editingContext - the editing context you can perform EO operations with.
channel - the channel to perform low level operations with
model - the model being downgraded
Throws:
java.lang.Throwable - if something fails

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.