mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 17:23:34 +02:00
Merge admin and api users
This commit is contained in:
parent
fcd3f4146b
commit
f3215680d5
6 changed files with 114 additions and 37 deletions
21
db/migrate/20150213104014_merge_api_user_and_user.rb
Normal file
21
db/migrate/20150213104014_merge_api_user_and_user.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
class MergeApiUserAndUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :registrar_id, :integer
|
||||
add_column :users, :active, :boolean, default: false
|
||||
add_column :users, :csr, :text
|
||||
add_column :users, :crt, :text
|
||||
add_column :users, :type, :string
|
||||
|
||||
User.all.each do |x|
|
||||
x.type = 'AdminUser'
|
||||
x.save
|
||||
end
|
||||
|
||||
ApiUserDeprecated.all.each do |x|
|
||||
attrs = x.attributes
|
||||
attrs.delete('id')
|
||||
ApiUser.skip_callback(:save, :before, :create_crt)
|
||||
ApiUser.create!(attrs)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue