1.4 -> 1.5 upgrade DB migration error

Hi,

when upgrade from 1.4.1 to 1.5 on a RHEL6 box (using SCL), i received the
following:

[root@puppethost foreman]# foreman-rake db:migrate
== MigratePermissions: migrating

··· ============================================= -- no old permissions found for role 'Manager', skipping -- no old permissions found for role 'Edit partition tables', skipping -- no old permissions found for role 'View hosts', skipping -- no old permissions found for role 'Edit hosts', skipping -- no old permissions found for role 'Viewer', skipping -- no old permissions found for role 'Site manager', skipping -- no old permissions found for role 'Default user', skipping -- no old permissions found for role 'Anonymous', skipping -- no old permissions found for role 'Anonymous_admin', skipping -- Migrating user 'admin' -- ... cloning all roles rake aborted! An error has occurred, all later migrations canceled:

Mysql2::Error: Column ‘nherited_from’ cannot be null: INSERT INTO
user_roles (nherited_from, owner_id, owner_type, role_id) VALUES
(NULL, 1, ‘User’, 10)

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I managed to “fix” AKA get round this by modifying the user_roles table to
allow NULL to be inserted into the nherited_from field - this doesn’t seem
like a permanent solution.

Any suggestions? I’m in a position where i’m able to rollback to 1.4,
thanks to a snapshotted VM.

thanks,

This column should have been removed in an older migration present in
1.4 (20130924145800_remove_unused_role_fields), so I'm surprised it's
still there. What's more, it's there without an "i" - it should have
read "inherited_from", so I guess it's been manually renamed.

I'd try rolling back, delete the column entirely under 1.4 and then upgrade.

··· On 13/05/14 14:48, Matthew Dickinson wrote: > Mysql2::Error: Column 'nherited_from' cannot be null: INSERT INTO > `user_roles` (`nherited_from`, `owner_id`, `owner_type`, `role_id`) VALUES > (NULL, 1, 'User', 10) > > Tasks: TOP => db:migrate > (See full trace by running task with --trace) > > > > I managed to "fix" AKA get round this by modifying the user_roles table > to allow NULL to be inserted into the nherited_from field - this doesn't > seem like a permanent solution. > > Any suggestions? I'm in a position where i'm able to rollback to 1.4, > thanks to a snapshotted VM.


Dominic Cleal
Red Hat Engineering