Class: CreatePorts

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/rflow/configuration/migrations/20010101000003_create_ports.rb

Class Method Summary collapse

Class Method Details

.downObject



21
22
23
# File 'lib/rflow/configuration/migrations/20010101000003_create_ports.rb', line 21

def self.down
  drop_table :ports
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rflow/configuration/migrations/20010101000003_create_ports.rb', line 2

def self.up
  create_table(:ports, :id => false) do |t|
    t.string :uuid, :limit => 36, :primary => true
    t.string :name

    # For STI
    t.text   :type

    # UUID version of belongs_to :component
    t.string :component_uuid

    t.timestamps
  end

  add_index :ports, :uuid, :unique => true
  add_index :ports, :component_uuid
  add_index :ports, [:component_uuid, :name], :unique => true
end