Hi,

Using Migrations I faced an issue. There is a table "TEST_TABLE" with existing 
data. I added a "Not Null" column "TEST_COLUMN" with default value "0". When I 
started migration, it failed to execute with following message:

Caused by: org.postgresql.util.PSQLException: ERROR: column 
"is_dynamic_integer" contains null values

The migration code is below which failed:

ERXMigrationTable testTable = database.existingTableNamed("TEST_TABLE");
testTable.newIntegerColumn("TEST_COLUMN", false, 0);

Here is the modified version that works:

ERXMigrationTable testTable = database.existingTableNamed("TEST_TABLE");
testTable.newIntegerColumn("TEST_COLUMN", true);
ERXJDBCUtilities.executeUpdateScript(database.adaptorChannel(), "UPDATE 
TEST_TABLE SET TEST_COLUMN = 0");
ERXMigrationColumn testColumn = testTable.existingColumnNamed("TEST_COLUMN");
testColumn.setAllowsNull(false);
testColumn.setDefaultValue(0);

Is this something I should always do for any additional Not Null column?

Thanks,

Farrukh
 _______________________________________________
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