I think there are a couple of ways to do this. The simplest is to specify in a 
Properties file the models that need to be migrated using a comma separated 
list of model names. The order in which the names appear is the order in which 
the migrations will run. For example:

        er.migration.modelNames=ERAttachment,MyOtherModel,MyModel

I believe this will migrate completely ERAttachment, then MyOtherModel and 
finally MyModel (meaning that all migrations for a single model will be 
completed before moving on to the next). Note that if you don’t specify an 
order in your Properties file, the order defined by the ordering of the default 
model group, which is probably not what you want.

If you need more fine-grained control, you can specify specific model version 
dependencies in your migration class. For example, if MyOtherModel3 should not 
be run until MyModel1 has been run, you can override the modelDependencies() 
method in MyOtherModel3.java:

public NSArray<ERXModelVersion> modelDependencies() {
        return new NSArray<ERXModelVersion>(new ERXModelVersion[]{ new 
ERXModelVersion(“MyModel”,1 });
}

This should ensure that MyOtherModel3 will run after MyModel1 has completed, 
even though the order of the migrations in the Properties file lists 
MyOtherModel before MyModel.


F

— 
Faizel Dakri
[email protected] <mailto:[email protected]>



> On 2014-Nov-09, at 09:14 AM, Theodore Petrosky <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> I am working on a project that requires ERAttachment. I am also using 
> migrations in my app. As I am in the early stages, there are times I just 
> drop the database, recreate it and let the migrations run from this empty 
> database.
> 
> I keep running into an issue where I am starting up on a fresh clean 
> database. the apps fails to launch with:
> 
> Nov 07 12:39:10 ASClientApproval[63195] ERROR 
> er.extensions.appserver.ERXApplication  - ASClientApproval failed to start.
> PSQLException: ERROR: relation "erattachment" does not exist
> 
> In the order pane of the Build Path section, I pushed ERAttachment to be the 
> first element.
> 
> What is going on here? ERAttachment is the first element in the order section 
> of the Build Path. I thought about creating a minimal first migration that 
> doesn’t really do much, and a second migration that does my real work. Why am 
> I jumping through hoops?
> 
> Ted
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected] 
> <mailto:[email protected]>)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/listfez%40dakri.com 
> <https://lists.apple.com/mailman/options/webobjects-dev/listfez%40dakri.com>
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to