Re: FK on composite keys
Re: FK on composite keys
- Subject: Re: FK on composite keys
- From: Kieran Kelleher <email@hidden>
- Date: Tue, 28 Dec 2010 17:57:42 -0500
I often use Migrations to execute a SQL script file, which really allows you to do whatever you want to migrate the data. Also, you can combine regular migration java statements and then call a single line of java to execute the SQL file..... Here is an example......
@Override
public void upgrade(EOEditingContext editingContext, ERXMigrationDatabase database) throws Throwable {
// Regular migration style logic
ERXMigrationTable lCRoleTable = database.newTableNamed("role");
lCRoleTable.newStringColumn("descriptor", 255, false);
lCRoleTable.newIntegerColumn("oid", false);
lCRoleTable.create();
lCRoleTable.setPrimaryKey("oid");
// Execute a bunch of custom SQL from a SQL file that can be found in Resources dir
EOAdaptorChannel channel = database.adaptorChannel();
ERXJDBCUtilities.executeUpdateScriptFromResourceNamed(channel, "LCBusinessLogicMigration8.sql", "LCBusinessLogic");
}
HTH,
Kieran
On Dec 28, 2010, at 4:23 PM, Michael Gargano wrote:
> Am I to understand correctly that migrations do not support FK constraints on composite keys? What do I do in this situation use the JDBC connection?
>
> Thanks.
> -Mike
>
> _______________________________________________
> 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