Class: CreateGrants

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/granted/db/migrations/create_grants.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.filenameObject



2
3
4
# File 'lib/granted/db/migrations/create_grants.rb', line 2

def self.filename
  __FILE__
end

Instance Method Details

#changeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/granted/db/migrations/create_grants.rb', line 6

def change
  create_table :grants do |t|
    t.integer :grantee_id
    t.string  :grantee_type
    t.integer :subject_id
    t.string  :subject_type
    t.string  :type

    t.timestamps
  end

  add_index :grants, [:grantee_id, :grantee_type, :subject_id, :subject_type, :type], unique: true, name: :grants_uniqueness
end