class CreatePersistenceTables

Public Class Methods

down() click to toggle source
# File lib/generators/persistence/templates/db/migrate/001_create_persistence_tables.rb, line 25
def self.down
  drop_table :calculations
  drop_table :terms
end
up() click to toggle source
# File lib/generators/persistence/templates/db/migrate/001_create_persistence_tables.rb, line 2
def self.up
  create_table :calculations do |t|
    t.string  "profile_uid"
    t.string  "profile_item_uid"
    t.string  "calculation_type"

    t.timestamps
  end

  create_table :terms do |t|
    t.integer  "calculation_id"
    t.string  "label"
    t.string  "value"

    t.timestamps
  end

  add_index :calculations, :calculation_type
  add_index :calculations, :profile_item_uid
  add_index :terms, [:calculation_id, :label], :name => "calc_id_label_index"
  add_index :terms, [:label, :value, :calculation_id], :name => "label_name_calc_id_index"
end