Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create_table :makes do |t|
- t.string :name
- end
- create_table :models do |t|
- t.string :name
- # stores the class_name of model if it exists (eg C-Class, 3 Series etc....)
- t.string :class_name
- # tracks number of this model that are actually on the market
- t.column :on_market_count, :integer, :default => 0
- # tracks the number of make model searches done for for this make/model
- t.integer :search_count, :default => 0
- end
- # for many-to-many reference
- create_table :models_makes, :id => false do |column|
- column.integer :model_id, :null => false
- column.integer :make_id, :null => false
- end
- # add indexes
- add_index :makes, :name
- add_index :models, :name
- add_index :models_makes, :model_id
- add_index :models_makes, :make_id
Add Comment
Please, Sign In to add comment