--- /dev/null
+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 :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
+
+ def self.down
+ drop_table :purchases
+ end
+end
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
-ActiveRecord::Schema.define(:version => 15) do
+ActiveRecord::Schema.define(:version => 16) do
create_table "bitems", :force => true do |t|
t.column "customer_id", :integer, :null => false
t.column "price", :decimal, :precision => 8, :scale => 2, :default => 0.0
end
+ create_table "purchases", :force => true do |t|
+ t.column "type", :string
+ t.column "customer_id", :integer
+ t.column "date", :date
+ t.column "price", :decimal, :precision => 8, :scale => 2, :default => 0.0
+ t.column "rentable_id", :integer
+ t.column "due_date", :date
+ t.column "merchandise_id", :integer
+ t.column "quantity", :integer
+ end
+
create_table "rentables", :force => true do |t|
t.column "type", :string
t.column "title", :string