restful_open_id_authenticationプラグイン でOpenIDストアに使用していたDBを ruby-openid 2.0に移行させるためのマイグレーション。 ruby-openid 2.0のexamplesから抜粋。

   1  # Use this migration to upgrade the old 1.1 ActiveRecord store schema
   2  # to the new 2.0 schema.
   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の 内容が変わります。

posted by Png genki on Fri 21 Dec 2007 at 06:40

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry277
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ