diff options
author | Valery Sizov <vsv2711@gmail.com> | 2014-11-25 19:15:30 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2014-12-04 14:01:50 +0300 |
commit | 1a80d13a3990937580c97e2b0ba8fb98f69bc055 (patch) | |
tree | d073b436e6585b0d025163f10e5762578fcbc169 /db/migrate/20141121161704_add_identity_table.rb | |
parent | 236741008ed82b77e3e4357e07060f7764d1d21a (diff) |
Multi-provider auth. LDAP is not reworked
Diffstat (limited to 'db/migrate/20141121161704_add_identity_table.rb')
-rw-r--r-- | db/migrate/20141121161704_add_identity_table.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20141121161704_add_identity_table.rb b/db/migrate/20141121161704_add_identity_table.rb new file mode 100644 index 00000000000..7d019c65ee1 --- /dev/null +++ b/db/migrate/20141121161704_add_identity_table.rb @@ -0,0 +1,21 @@ +class AddIdentityTable < ActiveRecord::Migration + def up + create_table :identities do |t| + t.string :extern_uid + t.string :provider + t.references :user + end + + add_index :identities, :user_id + + User.where("provider is not NULL").find_each do |user| + execute "INSERT INTO identities(provider, extern_uid, user_id) VALUES('#{user.provider}', '#{user.extern_uid}', '#{user.id}')" + end + + #TODO remove user's columns extern_uid and provider + end + + def down +#TODO + end +end |