Class: CreateGroups

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/apn_on_rails/install/templates/005_create_groups.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.downObject


19
20
21
22
# File 'lib/generators/apn_on_rails/install/templates/005_create_groups.rb', line 19

def self.down
  drop_table :apn_groups
  drop_table :apn_devices_apn_groups
end

.upObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/apn_on_rails/install/templates/005_create_groups.rb', line 2

def self.up
  create_table :apn_groups do |t|
    t.column :name, :string
  
    t.timestamps
  end
  
  create_table :apn_devices_apn_groups, :id => false do |t|
    t.column :group_id, :integer
    t.column :device_id, :integer
  end
  
  add_index :apn_devices_apn_groups, [:group_id, :device_id]
  add_index :apn_devices_apn_groups, :device_id
  add_index :apn_devices_apn_groups, :group_id
end