From 7d8dfccf70da047b68f974b7e63610f5c7bf1a43 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 8 Dec 2014 15:15:11 +0200 Subject: [PATCH] speed up migration to identities --- .../20141121161704_add_identity_table.rb | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/db/migrate/20141121161704_add_identity_table.rb b/db/migrate/20141121161704_add_identity_table.rb index 243958039af..6fe63637dfe 100644 --- a/db/migrate/20141121161704_add_identity_table.rb +++ b/db/migrate/20141121161704_add_identity_table.rb @@ -8,9 +8,11 @@ class AddIdentityTable < ActiveRecord::Migration 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 + execute <