Redid up to end of Chapter 6 under Rails2.2.2 and Gems 1.3.1, with Product.date_available
[depot.git] / db / migrate / 20090202163608_add_test_data.rb
diff --git a/db/migrate/20090202163608_add_test_data.rb b/db/migrate/20090202163608_add_test_data.rb
new file mode 100644 (file)
index 0000000..5b79b4f
--- /dev/null
@@ -0,0 +1,71 @@
+class AddTestData < ActiveRecord::Migration
+  def self.up
+    Product.delete_all
+
+    Product.create(:title => 'Snowball',
+      :description => 
+        %{<p>
+            The perfect gift for a hot summer's day.  What could be better 
+            than to surprise a loved one a gift of winter coolness?  This
+            snowball has been loving crafted from the purest snow, hand-collected
+            from the pristine lawn of our back garden.  
+          </p>
+          <p>
+            Note that this is a perisiable item and some melting may occur 
+            while the snowball is in transit. 
+          </p>
+        },
+        :image_url => '/images/snowball.jpg',
+        :price => 12.00,
+        :date_available => Time.utc(2008, 12, 31)
+    )
+    
+    Product.create(:title => 'Daisy',
+      :description => 
+        %{<p>
+            All the world is better for having flowers in it.  And your home 
+            will be the better for having this fine example of <i>Bellis 
+            perennis</i> gracing its walls.  The range of uses of this item are
+            truly remarkable.  You can place it in an eggcup of water, you can 
+            insert it in a jacket for a subtle buttonhole posy, or you even 
+            purchase a multi-pack to create your own daisy chain!
+          </p>
+        },
+      :image_url => '/images/daisy.gif',
+      :price => 5.00,
+      :date_available => Time.utc(2011, 7, 1)
+      )
+      
+    Product.create(:title => 'Cardboard Box',
+      :description =>
+        %{<p>The gift that keeps on giving, you'll wonder how you ever did 
+            without a cardboard box in your home.  Us it for a range of uses, 
+            including putting things in and keeping things in.  We can provide
+            you with a cardboard box that is versatile and suitable for any
+            occasion.  Some of our directors even use them for sleeping in!
+          </p>
+        },
+      :image_url => '/images/cardboard-box.jpg',
+      :price => 10.00,
+      :date_available => Time.utc(2007, 1, 1)
+      )
+
+    Product.create(:title => 'Air',
+      :description =>
+        %{<p>An essential for all activities, <i>Air</i> is vital for your
+            wellbeing and vitality.  Our air is carefully packaged to contain
+            only 100% pure air, with no artificial colours or preservatives.
+          </p>
+          <p>May contain nuts.
+          </p>
+        },
+      :image_url => '/images/can-of-air.jpg',
+      :price => 5000.00,
+      :date_available => Time.utc(2009, 1, 1)
+      )
+  end
+
+  def self.down
+    Product.delete_all
+  end
+end