On Feb 20, 2009, at 1:56 PM, Chuck Hill wrote:


On Feb 16, 2009, at 8:19 PM, Kevin Windham wrote:


On Feb 16, 2009, at 8:37 PM, Chuck Hill wrote:

On Feb 14, 2009, at 10:56 AM, Kevin Windham wrote:

I was going through part two of the WO Podcast that David LeBer did, and I noticed a difference in the way his code worked with MySQL and mine worked with FrontBase.

In the second migration there is a bit of code that adds some groups and some users into the DB. In one of the lines the user table is updated to include a foreign key for the relationship to the group table.

table = database.existingTableNamed("t_user");
table.newIntegerColumn("c_group_id", true);

In David's code the allows null for that second line is false, instead of true. I had to change it to true in order for the migration to complete. I think the reason was that FrontBase was enforcing the constraint on the one existing user in the table and since the column is empty on creation it threw an error. Changing that parameter to true allowed the migration to complete.

Did I miss something in following the tutorial, or is this just a difference in how the DBs operate. Is this something that will need to be handled on a case by case basis, and if so how do you account for scenarios where you might need to run an app on multiple DBs, or move from one DB to another?

When the FB database was created, did the FK constraints get marked as DEFERRED INITIALLY DEFERRED? Are you using the FB plugin from Wonder? Are you certain?

The database doesn't appear to have been created that way. It doesn't have any constraints or reference listed on the foreign key.

That seem unlikely given what  you said above.  Where are you looking?

This is the SQL listed under the definition of the table in FrontBase Manager. The c_group_id is the foreign key to the t_group table, and that is the field I had to set allow null to true on in order to get the example to work.

create table "_SYSTEM"."t_user"
(
        "c_first_name" varchar(255) not null,
        "c_last_name" varchar(255) not null,
        "c_password" varchar(255) not null,
        "c_username" varchar(255) not null,
        "id" int,
        "c_group_id" int,
        PRIMARY_KEY_t_user_id primary key ("id")
);


_______________________________________________
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