Re: migration and null problem

2008-04-04 Thread Mike Schrag

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.

"fails".  Fails how?  Exact exception, please.  What WO version?

ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


migration and null problem

2008-04-04 Thread Theodore Petrosky
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  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]