Class: CreatePins

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/db/migrate/015_create_pins.rb

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
# File 'lib/db/migrate/015_create_pins.rb', line 16

def self.down
  drop_table :pins
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/db/migrate/015_create_pins.rb', line 2

def self.up
  create_table "pins", force: :cascade do |t|
    t.integer "number",                          null: false
    t.integer "chip_id",   limit: 4,             null: false
    t.integer "signal_id", limit: 4, default: 1, null: false
  end

  add_index "pins", ["chip_id"], name: "index_pins_on_chip_id", using: :btree
  add_index "pins", ["signal_id"], name: "index_pins_on_signal_id", using: :btree

  add_foreign_key "pins", "chips"
  add_foreign_key "pins", "signals"
end