mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Refactor roles
This commit is contained in:
parent
b527221baf
commit
b0eb6798b0
16 changed files with 155 additions and 223 deletions
16
db/migrate/20150120140346_refactor_roles.rb
Normal file
16
db/migrate/20150120140346_refactor_roles.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class RefactorRoles < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :roles, :string, array: true
|
||||
|
||||
User.all.each do |x|
|
||||
x.roles = [x.role.code]
|
||||
x.save
|
||||
end
|
||||
|
||||
remove_column :users, :role_id
|
||||
|
||||
drop_table :roles
|
||||
drop_table :rights
|
||||
drop_table :rights_roles
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue