Sha256: f5d51e350ea9efd5e23277604e293da9eb6cc3b2ed161cbecce368c6eba2dc0a

Contents?: true

Size: 854 Bytes

Versions: 8

Compression:

Stored size: 854 Bytes

Contents

class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
  def up
    change_table :<%= table_name %> do |t|
      t.string     :invitation_token
      t.datetime   :invitation_created_at
      t.datetime   :invitation_sent_at
      t.datetime   :invitation_accepted_at
      t.integer    :invitation_limit
      t.references :invited_by, polymorphic: true
      t.integer    :invitations_count, default: 0
      t.index      :invitations_count
      t.index      :invitation_token, unique: true # for invitable
      t.index      :invited_by_id
    end
  end

  def down
    change_table :<%= table_name %> do |t|
      t.remove_references :invited_by, polymorphic: true
      t.remove :invitations_count, :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token, :invitation_created_at
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
devise_invitable-1.7.2 lib/generators/active_record/templates/migration.rb
devise_invitable-1.7.1 lib/generators/active_record/templates/migration.rb
devise_invitable-1.7.0 lib/generators/active_record/templates/migration.rb
devise_invitable-1.6.1 lib/generators/active_record/templates/migration.rb
devise_invitable-1.6.0 lib/generators/active_record/templates/migration.rb
devise_invitable-1.5.5 lib/generators/active_record/templates/migration.rb
devise_invitable-1.5.3 lib/generators/active_record/templates/migration.rb
devise_invitable-1.5.2 lib/generators/active_record/templates/migration.rb