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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]