migration and null problem
migration and null problem
- Subject: migration and null problem
- From: Theodore Petrosky <email@hidden>
- Date: Fri, 4 Apr 2008 03:42:46 -0700 (PDT)
I am doing the WOLips example from the David LeBer
PodCast... Thanks David for some great work. I have a
problem that I can't seem to get my head around.
Notice the creation of the new column in t_user. I had
to change the allow null to true... If it is false,
then the whole process fails. I am using Postgresql as
the db. So the questions are; 1. can I use false and
make another setting change to allow the null to exist
until the end of the transaction.... 2. if I must use
true can I execute sql directly that will alter the
column and 'fix' the null problem?
And if I didn't say it loud enough.. Thanks David...
Ted
@Override
public void upgrade(EOEditingContext ec,
ERXMigrationDatabase database) throws Throwable {
ERXMigrationTable table =
database.newTableNamed("t_group");
table.newIntegerColumn("id", false);
table.newIntegerColumn("c_security_level", false);
table.newStringColumn("c_name", 255, false);
table.create();
table.setPrimaryKey("id");
table = database.existingTableNamed("t_user");
table.newIntegerColumn("c_group_id", true);
// INSERT INTO t_user
(c_first_name, c_last_name, c_password, c_username,
id) VALUES ('Ted', 'Petrosky', 'demo', 'demo', 1)
ERXJDBCUtilities.executeUpdate(database.adaptorChannel(),
"INSERT INTO t_group (c_name, c_security_level, id)
VALUES ('Admin', '9', '1')");
ERXJDBCUtilities.executeUpdate(database.adaptorChannel(),
"INSERT INTO t_group (c_name, c_security_level, id)
VALUES ('User', '0', '2')");
ERXJDBCUtilities.executeUpdate(database.adaptorChannel(),
"INSERT INTO t_user (c_first_name, c_last_name,
c_password, c_username, c_group_id, id) VALUES
('Admin', 'User', 'admin', 'admin', '1', '2')");
ERXJDBCUtilities.executeUpdate(database.adaptorChannel(),
"UPDATE t_user SET c_group_id = '2' WHERE id = '1'");
}
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
_______________________________________________
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