Sha256: 1b98ba4fb3ea3b4921dd2b33535f8dd0afb04e6fc889b81f8782afc5e60768b4

Contents?: true

Size: 936 Bytes

Versions: 6

Compression:

Stored size: 936 Bytes

Contents

class PersonaDeviseInvitableAddToUsers < ActiveRecord::Migration[5.0]
  def up
    unless ActiveRecord::Base.connection.column_exists?(:users, :invitation_token)
      change_table :users 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
  end

  def down
    change_table :users 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

6 entries across 6 versions & 1 rubygems

Version Path
samvera-persona-0.5.0 db/migrate/20190628003746_persona_devise_invitable_add_to_users.rb
samvera-persona-0.4.1 db/migrate/20190628003746_persona_devise_invitable_add_to_users.rb
samvera-persona-0.4.0 db/migrate/20190628003746_persona_devise_invitable_add_to_users.rb
samvera-persona-0.3.0 db/migrate/20190628003746_persona_devise_invitable_add_to_users.rb
samvera-persona-0.2.0 db/migrate/20190628003746_persona_devise_invitable_add_to_users.rb
samvera-persona-0.1.7 db/migrate/20190628003746_persona_devise_invitable_add_to_users.rb