class CreatePurchases < ActiveRecord::Migration
def self.up
create_table :purchases do |t|
+ # STI Required
+ t.column :type, :string
+
+ # Both
t.column :customer_id, :integer
- t.column :purchaseable_id, :integer
- t.column :purchaseable_type, :string
+ t.column :date, :date
+ t.column :price, :decimal, :precision => 8, :scale => 2, :default => 0
+
+ # RentablePurchase only
+ t.column :rentable_id, :integer
+ t.column :due_date, :date
+
+ # MerchandisePurchase only
+ t.column :merchandise_id, :integer
+ t.column :quantity, :integer
end
end