restful_open_id_authenticationプラグイン
でOpenIDストアに使用していたDBを
ruby-openid 2.0に移行させるためのマイグレーション。
ruby-openid 2.0のexamplesから抜粋。
1
2
3 class UpgradeOpenIdStore < ActiveRecord::Migration
4 def self.up
5 drop_table "open_id_settings"
6 drop_table "open_id_nonces"
7 create_table "open_id_nonces", :force => true do |t|
8 t.column :server_url, :string, :null => false
9 t.column :timestamp, :integer, :null => false
10 t.column :salt, :string, :null => false
11 end
12 end
13
14 def self.down
15 drop_table "open_id_nonces"
16 create_table "open_id_nonces", :force => true do |t|
17 t.column "nonce", :string
18 t.column "created", :integer
19 end
20
21 create_table "open_id_settings", :force => true do |t|
22 t.column "setting", :string
23 t.column "value", :binary
24 end
25 end
26 end
ちなみにオリジナルのプラグインが生成したマイグレーションコードはこちら。
1 create_table :open_id_associations, :force => true do |t|
2 t.column :server_url, :binary
3 t.column :handle, :string
4 t.column :secret, :binary
5 t.column :issued, :integer
6 t.column :lifetime, :integer
7 t.column :assoc_type, :string
8 end
9
10 create_table :open_id_nonces, :force => true do |t|
11 t.column :nonce, :string
12 t.column :created, :integer
13 end
14
15 create_table :open_id_settings, :force => true do |t|
16 t.column :setting, :string
17 t.column :value, :binary
18 end
open_id_settingsは不要になって、open_id_nouncesの
内容が変わります。