On 05/06/2011 11:02 AM, Mark McLoughlin wrote:
I was getting this error when running 'rake db:migrate' with
SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER
TABLE "deployables" ADD "uuid" varchar(255) NOT NULL
To avoid the warning, we can add the column as nullable and then change
it to non-null later.
Presumably this would fail if we ran the migration on a DB containing
any data in the deployables table, but this is unlikely. To avoid it,
we could do e.g.
Deployable.all.each do |deployable|
deployable.uuid = "" if deployable.uuid.nil?
deployable.xml = "" if deployable.xml.nil?
but that seems like overkill given the situation, especially since the
default values don't make any sense.
.../migrate/20110207100800_update_deployables.rb | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
ACK to both in the patchset, and
I just pushed them.
I had to fix the first patch to handle the legacy_ renaming of those
tables, but otherwise it all works.