1 class RenameOpenidUrl < ActiveRecord::Migration[4.2]
2 class User < ApplicationRecord
6 rename_column :users, :openid_url, :auth_uid
7 add_column :users, :auth_provider, :string
9 User.where.not(:auth_uid => nil).update_all(:auth_provider => "openid")
11 add_index :users, [:auth_provider, :auth_uid], :unique => true, :name => "users_auth_idx"
12 remove_index :users, :column => :auth_uid, :unique => true, :name => "user_openid_url_idx"