From 51e5c301fa78679232f16b450632fc890c02c4f2 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Thu, 22 Nov 2007 17:13:00 -0800 Subject: [PATCH] Add purchases table Signed-off-by: Ira W. Snyder --- app/models/purchase.rb | 2 ++ db/development.sqlite3 | Bin 11264 -> 13312 bytes db/migrate/016_create_purchases.rb | 25 +++++++++++++++++++++++++ db/schema.rb | 13 ++++++++++++- test/fixtures/purchases.yml | 5 +++++ test/unit/purchase_test.rb | 10 ++++++++++ 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/models/purchase.rb create mode 100644 db/migrate/016_create_purchases.rb create mode 100644 test/fixtures/purchases.yml create mode 100644 test/unit/purchase_test.rb diff --git a/app/models/purchase.rb b/app/models/purchase.rb new file mode 100644 index 0000000..e688f99 --- /dev/null +++ b/app/models/purchase.rb @@ -0,0 +1,2 @@ +class Purchase < ActiveRecord::Base +end diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 10e50e7d4e68027ab0e2dc78f2efe5e5df8782e3..b02e912f1c434859016cd5497e185fcaec165e0e 100644 GIT binary patch delta 280 zcmZpOXvml#EqIp!6_`%cvEgB2{st1|W&X|lZL=UtD>FMMCy>v^wu$9GGo!#J4i+9B z7DhJ)MmNSOO!dr-8yn3SHy;(XW|}OdRKH1rg@cQkF`R)hoaq>|*~Ugs#?2Fz@);*D zQY@H!L*djS6%ICDknt=)qhB#k3=rS}ahVw3F)+Sknzga<5#wYXg*E0)$=vMX^74$W zq9ut*IjIGuMadb7#i_+`29I-)t7C|(LWrZ2kE;Sqc=CBg^~vv*lqNSSh)!-0;}=Xx wEJ;;T0FeqVu5ON@K9j2z)h73dsZV|+COvtcg7oBUW&X*ric+k8p*}vE0OdSQY5)KL delta 122 zcmZq3Xo#2~EqI#&6_`xavEgE5{tXi4Wd6Nbkfn#2iH&s=%YSA@{!JV#JY39-M;RE8 zG6^&N+t|3BakHDKHPa>u77jjE1|0?_A*P9pix_S&=uC8!n*7di&15s>Q 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 diff --git a/db/schema.rb b/db/schema.rb index dcfe7d9..212ac71 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,7 +2,7 @@ # 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 @@ -35,6 +35,17 @@ ActiveRecord::Schema.define(:version => 15) do 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 diff --git a/test/fixtures/purchases.yml b/test/fixtures/purchases.yml new file mode 100644 index 0000000..b49c4eb --- /dev/null +++ b/test/fixtures/purchases.yml @@ -0,0 +1,5 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +one: + id: 1 +two: + id: 2 diff --git a/test/unit/purchase_test.rb b/test/unit/purchase_test.rb new file mode 100644 index 0000000..f9a5498 --- /dev/null +++ b/test/unit/purchase_test.rb @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class PurchaseTest < Test::Unit::TestCase + fixtures :purchases + + # Replace this with your real tests. + def test_truth + assert true + end +end -- 2.25.1