Re: Migrations + Frontbase

From: David Holt (programmingos..ac.com)
Date: Wed Oct 15 2008 - 14:37:51 EDT

  • Next message: Jon Nolan: "Re: Migrations + Frontbase"

    Hi Jon,

    On 15-Oct-08, at 11:18 AM, Jon Nolan wrote:

    > Good afternoon,
    >
    > I'm implementing migrations for the first time. After struggling a
    > bit with the syntax for the _dbupdater table creation (Frontbase
    > doesn't like leading underscores without the table name being
    > quoted) I got things running.

    You shouldn't need to create this table manually if you're using
    migrations. If it doesn't exist, it is created automatically. I have
    not had a problem with the Frontbase plugin.

    > At least I was able to run my initial migration test:
    >
    > public class TestMigration0 extends Migration {
    >
    > ..verride
    > public void downgrade(EOEditingContext ec, ERXMigrationDatabase
    > database) throws Throwable {
    > ...
    > }
    >
    > ..verride
    > public void upgrade(EOEditingContext ec, ERXMigrationDatabase
    > database) throws Throwable {
    > ERXMigrationTable table = database.newTableNamed("NEW_TABLE");
    > table.newIntegerColumn("NEW_TABLE_ID", false);
    > table.newStringColumn("NEW_TABLE_STRING_1", 100, true);
    > table.newStringColumn("NEW_TABLE_STRING_2", 100, true);
    > table.newStringColumn("NEW_TABLE_STRING_3", 100, true);
    > table.create();
    > table.setPrimaryKey("NEW_TABLE_ID");
    >
    > }
    >
    > }
    >
    > So far so good. I then tried to implement a second migration class:
    >
    > public class TestMigration1 extends Migration {
    >
    > ..verride
    > public void downgrade(EOEditingContext ec, ERXMigrationDatabase
    > database) throws Throwable {
    > ...
    > }
    >
    > ..verride
    > public void upgrade(EOEditingContext ec, ERXMigrationDatabase
    > database) throws Throwable {
    > ERXMigrationTable table = database.existingTableNamed("NEW_TABLE");
    > table.newStringColumn("NEW_TABLE_STRING_4", 100, true);
    > }
    >
    > }
    >

    Your code looks right to me. Could "table" be a reserved word? Try
    "testTable" or something?

    > This results in a failure due to invalid SQL. The alter statement
    > looks something like this:
    >
    > alter table NEW_TABLE null NEW_TABLE_STRING_4 VARCHAR(100)

    not sure where this "null" is coming from. See above....

    >
    > That's obviously not going to work. Would any of you have any idea
    > where I went wrong?
    >
    > Thanks,
    > Jon
    >
    > OSX 10.5.5
    > Eclipse 3.3.2
    > WOLips 3.3.5503
    > WO 5.4.3
    > Wonder 10/12/08
    > Frontbase 4.2.7
    >



    This archive was generated by hypermail 2.0.0 : Wed Oct 15 2008 - 14:38:34 EDT