The transaction handling for Migrations is a bit sloppy, partly because the
JDBC transaction can be started and stopped directly without telling EOF,
and that can lead to problems.  I created a patch to fix it, the jira is
here <http://issues.objectstyle.org/jira/browse/WONDER-706> so you can vote
for it.  If you apply the patch and it fixes it, that would be good to know.

John

On Tue, Nov 1, 2011 at 9:06 AM, Theodore Petrosky <[email protected]> wrote:

> I use migrations for all of my company stuff. They are great!!!!
>
> I am running into a problem:
>
> public void upgrade(EOEditingContext editingContext, ERXMigrationDatabase
> database) throws Throwable {
>
>                ERXMigrationTable workingTable =
> database.existingTableNamed("t_employee");
>
>                workingTable.newLargeStringColumn("c_password", true);
>                workingTable.newLargeStringColumn("c_user_name", true);
>
>                ERXJDBCUtilities.executeUpdate(database.adaptorChannel(),
> "update t_employee " +
>                                "set c_password = '4004'");
>
>                ERXJDBCUtilities.executeUpdate(database.adaptorChannel(),
> "update t_employee " +
>                                "set c_user_name = 'theuser'");
>
>
>  workingTable.existingColumnNamed("c_password").setAllowsNull(false);
>
>  workingTable.existingColumnNamed("c_user_name").setAllowsNull(false);
>
> }
>
> I get an error:
>
> ERROR: cannot ALTER TABLE "t_employee" because it has pending trigger
> events
>
> migrations doesn't like it when I try to update these two columns in one
> pass.
>
> My solution is to create a migration after this one and put (obviously
> commenting out those lines in the first migration):
>
> public void upgrade(EOEditingContext editingContext, ERXMigrationDatabase
> database) throws Throwable {
>
>        ERXMigrationTable workingTable =
> database.existingTableNamed("t_employee");
>
>        ERXJDBCUtilities.executeUpdate(database.adaptorChannel(), "update
> t_employee " +
>        "set c_user_name = 'theuser'");
>
>
>  workingTable.existingColumnNamed("c_user_name").setAllowsNull(false);
>
> }
>
> can this be done in one pass?
>
> Ted
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/johnthuss%40gmail.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:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to