Affects Version/s: None
Fix Version/s: None
Environment:MacOS X 10.4.11, Java 1.5.0_13, JRuby trunk r5512, rails 2.0.2, activerecord-jdbc-adapter 0.7.1, activerecord-jdbcderby-adapter 0.7.1
Number of attachments :
Migrating a set of migrations from mysql to derby I found that I couldn't create columns in a derby database with a 'NOT NULL' constraint unless I also set a default value.
It is common in rails apps to set ":null => false" as a column constraint without specifying a default value.
Perhaps this is not an error in the jdbcderby adaptor but instead a function of how Derby itself operates.
Here's a simple test case.
Create a simple rails testapp:
Edit config/database.yml to use derby instead of mysql:
Create a scaffold with a migration:
Here's what the schem looks like now:
Create a new migration adding a column:
The migration fails:
If instead a default value is added to the new column definition:
The migration succeeds.