Sha256: b38060d25835d6d003011b0993129b3fe04b3daacd9d539f306c5dd716f65efb

Contents?: true

Size: 1.52 KB

Versions: 10

Compression:

Stored size: 1.52 KB

Contents

class AddAuthlogicRpxMigration < ActiveRecord::Migration
  def self.up
    create_table :rpx_identifiers do |t|
      t.string  :identifier, :null => false
      t.string  :provider_name
      t.integer :<%= user_model_base %>_id, :null => false
      t.timestamps
    end
    add_index :rpx_identifiers, :identifier, :unique => true, :null => false
    add_index :rpx_identifiers, :<%= user_model_base %>_id, :unique => false, :null => false
    
    # == Customisation may be required here ==
    # You may need to remove database constraints on other fields if they will be unused in the RPX case
    # (e.g. crypted_password and password_salt to make password authentication optional). 
    # If you are using auto-registration, you must also remove any database constraints for fields that will be automatically mapped
    # e.g.:
    #change_column :<%= user_model_collection %>, :crypted_password, :string, :default => nil, :null => true
    #change_column :<%= user_model_collection %>, :password_salt, :string, :default => nil, :null => true
    
  end
  
  def self.down
    drop_table :rpx_identifiers
    
    # == Customisation may be required here ==
    # Restore user model database constraints as appropriate
    # e.g.:
    #[:crypted_password, :password_salt].each do |field|
    #  <%= user_model %>.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
    #  change_column :<%= user_model_collection %>, field, :string, :default => "", :null => false
    #end

  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
Empact-authlogic_rpx-2.0.0 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
slayer-authlogic_rpx-1.2.1 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
authlogic_rpx-1.2.0 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.8 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.7 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.6 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.5 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.4 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.3 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb
Empact-authlogic_rpx-1.1.2 generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb