• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: migrations error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: migrations error


  • Subject: Re: migrations error
  • From: John Huss <email@hidden>
  • Date: Tue, 01 Nov 2011 09:56:38 -0500

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 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@hidden> 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@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

References: 
 >migrations error (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: migrations error
  • Next by Date: Re: migrations error
  • Previous by thread: migrations error
  • Next by thread: Re: migrations error
  • Index(es):
    • Date
    • Thread