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/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to