Take out the "Large" part.

On Tue, Nov 1, 2011 at 1:34 PM, Theodore Petrosky <[email protected]> wrote:

> It doesn't seem to like it when I add the string.
>
> workingTable.newLargeStringColumn("c_password", false, "4004");
>
> The method newLargeStringColumn(String, boolean) in the type
> ERXMigrationTable is not applicable for the arguments (String,
>  boolean, String)
>
>
> Ted
>
> --- On Tue, 11/1/11, John Huss <[email protected]> wrote:
>
> From: John Huss <[email protected]>
> Subject: Re: migrations error
> To: "Ramsey Gurley" <[email protected]>
> Cc: "Theodore Petrosky" <[email protected]>,
> [email protected]
> Date: Tuesday, November 1, 2011, 12:07 PM
>
> Ah, I didn't really read it either  :-)
> Yeah you should just pass the default value and NOT NULL in the newColumn
> call:
> workingTable.newLargeStringColumn("c_password", false, "4004");
>
> workingTable.newLargeStringColumn("c_user_name", false, "theuser");
>
>
> On Tue, Nov 1, 2011 at 10:37 AM, Ramsey Gurley <[email protected]>
> wrote:
>
> Oops… just looked more closely at your sql. You're setting values on all
> the rows, aren't you?  I believe that can be done by simply setting the
> default value in the new column method, but I'll defer to John on that.  I
> don't use the defaults so I may be mistaken.
>
> Ramsey
> On Nov 1, 2011, at 8:32 AM, Ramsey Gurley wrote:
>
> I think this is commonly handled in a post migration
>
> http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/migration/IERXPostMigration.html
>
> Just make your migration implement that interface, and the post migration
> method will be called after the tables are created.  From the package
> documentation:
>
> To perform a "post op", your migration can implement IERXPostMigration
> instead of IERXMigration, and this adds the additional method:   public
> void postUpgrade(EOEditingContext editingContext, EOModel model) throws
> Throwable;
> So as migrations are running in dependency order, ERXMigrator keeps track
> of "Post Migrations", which will themselves execute in dependency order,
> but only after a completely successful model migration. So by the time
> IERXPostMigrations begin to run, all of your EOModels will match the
> database tables. postUpgrades also each run in a transaction.
> editingContext.saveChanges() will be called for you after postUpgrade is
> done.
>
> Ramsey
> On Nov 1, 2011, at 7:06 AM, Theodore Petrosky 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/ramseygurley%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/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