Class: CreateDeviceGroups

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

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.downObject


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/apn_on_rails/install/templates/007_create_device_groups.rb', line 15

def self.down
  drop_table :apn_device_groupings

  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

.upObject


2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/apn_on_rails/install/templates/007_create_device_groups.rb', line 2

def self.up
  drop_table :apn_devices_apn_groups
  
  create_table :apn_device_groupings do |t|
    t.column :group_id, :integer
    t.column :device_id, :integer
  end
  
  add_index :apn_device_groupings, [:group_id, :device_id]
  add_index :apn_device_groupings, :device_id
  add_index :apn_device_groupings, :group_id
end