]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20150222101847_rename_openid_url.rb
Add frozen_string_literal comments to ruby files
[rails.git] / db / migrate / 20150222101847_rename_openid_url.rb
1 # frozen_string_literal: true
2
3 class RenameOpenidUrl < ActiveRecord::Migration[4.2]
4   class User < ApplicationRecord
5   end
6
7   def change
8     rename_column :users, :openid_url, :auth_uid
9     add_column :users, :auth_provider, :string
10
11     User.where.not(:auth_uid => nil).update_all(:auth_provider => "openid")
12
13     add_index :users, [:auth_provider, :auth_uid], :unique => true, :name => "users_auth_idx"
14     remove_index :users, :column => :auth_uid, :unique => true, :name => "user_openid_url_idx"
15   end
16 end