• 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
Migration bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Migration bug?


  • Subject: Migration bug?
  • From: Mark Woollard <email@hidden>
  • Date: Sat, 2 Jan 2010 17:23:11 +0000

Am using Wonder Project migration for the first time. The initial database creation works but am now trying to add a single column as the second revision of the database. When running application am getting error as follows:

Jan 02 17:13:28 TheApp[53817] INFO  er.extensions.jdbc.ERXJDBCUtilities  - Executing alter table t_position null c_abbreviation longtext NOT NULL
Jan 02 17:14:11 TheApp[53817] DEBUG NSLog  -  === Commit Internal Transaction
Jan 02 17:14:11 TheApp[53817] DEBUG NSLog  -  === Begin Internal Transaction
Jan 02 17:14:11 TheApp[53817] DEBUG NSLog  -  evaluateExpression: <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE _dbupdater SET lockowner = NULL, updatelock = ? WHERE modelname = ?" withBindings: 1:0(updateLock), 2:"MockDraft"(modelName)>
Jan 02 17:14:11 TheApp[53817] DEBUG NSLog  -  === Commit Internal Transaction
Jan 02 17:14:11 TheApp[53817] DEBUG NSLog  -  === Begin Internal Transaction
Jan 02 17:14:20 TheApp[53817] DEBUG NSLog  -  === Rollback Internal Transaction
Jan 02 17:14:36 TheApp[53817] ERROR er.extensions.appserver.ERXApplication  - TheApp failed to start.
MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null c_abbreviation longtext NOT NULL' at line 1

The database is mysql, and it seems to me that the alter statement is incorrect on the first line of the log, there should be 'add column' rather than 'null'. The migration class is as follows:

public class DbVersion1 extends Migration {

@Override
public void downgrade(EOEditingContext ec, ERXMigrationDatabase database)
throws Throwable {
database.existingTableNamed("t_position").existingColumnNamed("c_abbreviation").delete();
}

@Override
public void upgrade(EOEditingContext ec, ERXMigrationDatabase database)
throws Throwable {
ERXMigrationTable table = database.existingTableNamed("t_position");
table.newStringColumn("c_abbreviation", false, "");

}

}

The new column is using the varchar10 prototype. Am stuck as can't see why the sql is being generated incorrectly. Anyone have any ideas?

Thanks
Mark



 _______________________________________________
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

  • Follow-Ups:
    • Re: Migration bug?
      • From: David LeBer <email@hidden>
    • Re: Migration bug?
      • From: Mike Schrag <email@hidden>
  • Next by Date: Re: Migration bug?
  • Next by thread: Re: Migration bug?
  • Index(es):
    • Date
    • Thread