5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 15:36:22 +00:00
panel/db/migrate/20190705215536_devise_invitable_add_to_usuaries.rb
2019-07-05 20:56:43 -03:00

26 lines
900 B
Ruby

# frozen_string_literal: true
# Agregar gestión de invitaciones a usuaries
class DeviseInvitableAddToUsuaries < ActiveRecord::Migration[5.2]
def up
change_table :usuaries 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 :usuaries 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