Re: ERAttachments and Migration open a Jira?
Re: ERAttachments and Migration open a Jira?
- Subject: Re: ERAttachments and Migration open a Jira?
- From: Pascal Robert <email@hidden>
- Date: Sat, 16 Oct 2010 19:31:29 -0400
Do the ERAttachment stuff as Migration1... This is what I did for wocommunity (who is using PostgreSQL) :
public class WOCommunity1 extends ERAttachmentMigration {
public WOCommunity1() {
super("ORGANIZATION_PROFILE", "ORGP_LOGOID", true);
}
public NSArray<ERXModelVersion> modelDependencies() {
return null;
}
@Override
public void downgrade(EOEditingContext editingContext, ERXMigrationDatabase database) throws Throwable {
// DO NOTHING
}
}
My tables are all created in WOCommunity0, only the ERAttachment works in done in WOCommunity1.
> So here is my test case.
>
> 1. I created a new wonder project.
> 2. include the ERAttachment and Postgresql framewords
> 3. set my connection dictionary and migrations to:
>
> # Connection Dictionary
> dbConnectURLGLOBAL=jdbc:postgresql://localhost/thetestdb?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull
> dbConnectUserGLOBAL=asacksadmin
> dbConnectPasswordGLOBAL=4004
> dbConnectPluginGLOBAL=PostgresqlPlugIn
> dbConnectDriverGLOBAL=org.postgresql.Driver
>
>
> # Migrations
> er.migration.migrateAtStartup=true
> er.migration.createTablesIfNecessary=true
> er.migration.modelNames=MyEOModel
> MyEOModel.MigrationClassPrefix=your.app.migrations.Mig
>
> 4. Created a migration called Mig0 in the correct folder.
> 5. on running my webobjects app, it indeed created the erattachment tables.
>
> 6. stopped the app
> 7. dropdb
> 8. createdb
>
> 9. copied the migration from EOModeler:
>
> @Override
> public void upgrade(EOEditingContext editingContext, ERXMigrationDatabase database) throws Throwable {
> ERXMigrationTable newEntityTable = database.newTableNamed("t_new_entity");
> newEntityTable.newLargeStringColumn("c_first_name", false);
> newEntityTable.newIntegerColumn("id", false);
> newEntityTable.newIntegerColumn("c_photo_id", false);
> newEntityTable.create();
> newEntityTable.setPrimaryKey("id");
>
> newEntityTable.addForeignKey("c_photo_id", "ERAttachment", "id");
> }
>
> re-run the app. and it fails:
>
> Caused by: org.postgresql.util.PSQLException: ERROR: relation "erattachment" does not exist
>
> it seems that for Postgresql, it runs the EOModel migration before the erattachment migration which causes the failure because the erattachment tables have not been created yet.
>
> Should I open a Jira?
>
> I am never comfortable opening Jiras because I always feel the problems are my limited understanding.
>
> Ted
>
>
>
> --- On Sat, 10/16/10, David Holt <email@hidden> wrote:
>
>> From: David Holt <email@hidden>
>> Subject: Re: help with ERAttachments
>> To: "Theodore Petrosky" <email@hidden>
>> Cc: "Mike Schrag" <email@hidden>, email@hidden
>> Date: Saturday, October 16, 2010, 3:56 PM
>>
>> On 2010-10-16, at 11:48 AM, Theodore Petrosky wrote:
>>
>>> Let me state the question again,
>>>
>>> If you ran your migration against Frontbase, would you
>> expect your Tutorial0 to create both the Person table and
>> the erattachment table?
>>
>> Ahhh, no. The migrations for ERAttachment are happening
>> because you have included that framework in your build path
>> when you start up your application. If you look in the
>> _dbupdater table, you'll see the version for ERAttachment
>> framework model in a row in that table. You can find the
>> migrations files in the source code for the framework. By
>> enabling migrations at start up, you are going to run the
>> migrations in any frameworks that contain migration classes
>> as well (for example ERCoreBusinessLogic).
>>
>>>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden