Sha256: 913094ee62af76bbe1c913e9a426c2f9445c05bf44837c63af774dd577f07620

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

require 'devise/version'

class CreateTables < ActiveRecord::Migration
  def self.openid_authenticatable_fields(t)
    if Devise::VERSION < "2.1"
      require 'devise/schema'
      t.openid_authenticatable
    else
      t.string :identity_url
    end
  end

  def self.rememberable_fields(t)
    if Devise::VERSION < "2.1"
      require 'devise/schema'
      t.rememberable
    else
      t.string :remember_token
      t.datetime :remember_created_at
    end
  end

  def self.up
    create_table :users do |t|
      openid_authenticatable_fields t
      rememberable_fields t
      t.string :email
      t.timestamps
    end
    
    create_table :database_users do |t|
      openid_authenticatable_fields t
      if Devise::VERSION < "2.1"
        t.database_authenticatable
      else
        t.string :email,              :null => false, :default => ""
        t.string :encrypted_password, :null => false, :default => ""
      end

      t.timestamps
    end
    
    create_table :legacy_users do |t|
      openid_authenticatable_fields t
      rememberable_fields t
      t.string :email
      t.timestamps
    end
  end

  def self.down
    drop_table :users
    drop_table :database_users
    drop_table :legacy_users
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
devise_openid_authenticatable-1.3.0 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.2.1 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.2.0 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.1.6 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.1.5 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.1.4 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.1.3 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.1.2 spec/scenario/db/migrate/20100401102949_create_tables.rb
devise_openid_authenticatable-1.1.1 spec/scenario/db/migrate/20100401102949_create_tables.rb