Class: SetupTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/lookup/models.rb

Class Method Summary collapse

Class Method Details

.connectionObject



80
81
82
# File 'lib/lookup/models.rb', line 80

def self.connection
  Lookup::Api.connection
end

.upObject



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/lookup/models.rb', line 84

def self.up
  create_table :apis do |t|
    t.string :name, :url
  end
  
  create_table :entries do |t|
    t.string :name, :url
    t.references :constant
    t.integer :weighting, :default => 0
    t.integer :count, :default => 0
  end
  
  create_table :constants do |t|
    t.string :name, :url
    t.references :api
    t.integer :weighting, :default => 0
    t.integer :count, :default => 0
  end
end