mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
Migration fix
This commit is contained in:
parent
508b822d3f
commit
ef75de17d4
1 changed files with 5 additions and 2 deletions
|
@ -3,9 +3,12 @@ class RefactorRoles < ActiveRecord::Migration
|
||||||
add_column :users, :roles, :string, array: true
|
add_column :users, :roles, :string, array: true
|
||||||
|
|
||||||
User.all.each do |x|
|
User.all.each do |x|
|
||||||
x.roles = [x.role.code]
|
c = x.role.try(:code)
|
||||||
|
if c
|
||||||
|
x.roles = [c]
|
||||||
x.save
|
x.save
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
remove_column :users, :role_id
|
remove_column :users, :role_id
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue