daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest May 17th, 2018 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create_table :makes do |t|
  2.       t.string  :name
  3.     end
  4.  
  5.     create_table :models do |t|
  6.       t.string  :name
  7.       # stores the class_name of model if it exists (eg C-Class, 3 Series etc....)
  8.       t.string :class_name
  9.       # tracks number of this model that are actually on the market
  10.       t.column :on_market_count, :integer, :default => 0
  11.       # tracks the number of make model searches done for for this make/model
  12.       t.integer :search_count, :default => 0
  13.     end
  14.  
  15.     # for many-to-many reference
  16.     create_table :models_makes,  :id => false do |column|
  17.       column.integer :model_id,  :null => false
  18.       column.integer :make_id,   :null => false
  19.     end
  20.  
  21.  
  22.     # add indexes
  23.     add_index :makes,  :name
  24.     add_index :models, :name
  25.     add_index :models_makes, :model_id
  26.     add_index :models_makes, :make_id
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top