Sha256: 7db283944d2786c0ce7126ef35e0c21d620ad766aed776a35befcac0284b7139

Contents?: true

Size: 833 Bytes

Versions: 11

Compression:

Stored size: 833 Bytes

Contents

class CreateSocialiteIdentities < ActiveRecord::Migration
  def up
    create_table :<%= options[:identity_table] %> do |t|
      t.string :uid, :provider
      t.text :auth_hash
      t.integer :<%= "#{options[:users_table].singularize}_id" %>
      t.timestamps
    end

    add_index :<%= options[:identity_table] %>,
      :<%= "#{options[:users_table].singularize}_id" %>

    # Restrict each user to one identity per provider, to disable comment out.
    add_index :<%= options[:identity_table] %>,
      [:<%= "#{options[:users_table].singularize}_id" %>, :provider], :unique => true

    # Database constraint to ensure uniqueness of UIDs (scoped to provider)
    add_index :<%= options[:identity_table] %>,
      [:provider, :uid], :unique => true
  end

  def down
    drop_table :<%= options[:identity_table] %>
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
socialite-0.2.1 lib/generators/socialite/templates/identity.rb.erb
socialite-0.2.0 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.2 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.1 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre.7 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre.6 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre.5 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre.4 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre.3 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre.2 lib/generators/socialite/templates/identity.rb.erb
socialite-0.1.0.pre lib/generators/socialite/templates/identity.rb.erb