Emergya/redmine_cmi — Issue #1: Null role in migration
Author: nackd
Created: 2012-01-16 10:38:56+00:00
State: open

bn8 wrote:

I permit me to send you a message because I think I have potentially
find a bug in DB migration scripts of Redmine's CMI plugin. I just
install redmine_cmi plugin in my redmine existing installation and I
have an error when I execute "rak e db:migrate_plugins" command :

Migrating redmine_cmi...
== AddCostAndRoleToTimeEntry: migrating ======================================
-- add_column(:time_entries, :cost, :float, {:null=>false, :default=>0.0})
-> 0.0094s
-- add_column(:time_entries, :role, :string, {:null=>false})
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR: column "role" contains null values
: ALTER TABLE "time_entries" ALTER "role" SET NOT NULL

This error occur because my time_entries table currently contains entries.

In DB migration scripts :
- in 003_add_cost_and_role_to_time_entry.rb : a column role is had
with null value not permited
- in 005_allow_null_role.rb : null value is permited for role column