class Yinx::SQL::Tables

Public Instance Methods

down() click to toggle source
# File lib/yinx_sql.rb, line 40
def down
  [:notes_tags, :notes, :tags, :batches].each do |t|
    drop_table t
  end
end
up() click to toggle source
# File lib/yinx_sql.rb, line 15
def up
  create_table :batches do |t|
    t.timestamps
  end

  create_table :tags do |t|
    t.string :name
    t.belongs_to :batch
  end

  create_table :notes do |t|
    t.string :title
    t.string :book
    t.string :stack
    t.integer :content_length
    t.timestamps
    t.belongs_to :batch
  end

  create_table :notes_tags do |t|
    t.belongs_to :note, index: true
    t.belongs_to :tag, index: true
  end
end