Class: CreatePermissionsTable

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/private_person/install/templates/migrate/create_permissions_table.rb

Class Method Summary collapse

Class Method Details

.downObject


15
16
17
# File 'lib/generators/private_person/install/templates/migrate/create_permissions_table.rb', line 15

def self.down
  drop_table :permissions
end

.upObject


2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/private_person/install/templates/migrate/create_permissions_table.rb', line 2

def self.up
  create_table :permissions do |t|
    t.string      :permissor_type
    t.integer     :permissor_id
    t.string      :permissible_type
    t.integer     :permissible_id
    t.string      :relationship_type, :default => 'none'
    t.timestamps
  end

  add_index :permissions, [:permissor_type, :permissor_id]
  add_index :permissions, [:permissible_type, :permissible_id]
end