Add list of just-purchased items (this transaction) to the purchase view
[cs356-p2-videostore.git] / db / migrate / 020_rebuild_merchandises_table.rb
diff --git a/db/migrate/020_rebuild_merchandises_table.rb b/db/migrate/020_rebuild_merchandises_table.rb
new file mode 100644 (file)
index 0000000..e59901a
--- /dev/null
@@ -0,0 +1,24 @@
+class RebuildMerchandisesTable < ActiveRecord::Migration
+
+  # This whole thing is an awful way of doing a column rename
+
+  def self.up
+    drop_table :merchandises
+
+    create_table :merchandises do |t|
+      t.column :title, :string, :null => false
+      t.column :quantity, :integer, :null => false, :default => 0
+      t.column :price, :decimal, :precision => 8, :scale =>2, :default => 0
+    end
+  end
+
+  def self.down
+    drop_table :merchandises
+
+    create_table :merchandises do |t|
+      t.column :name, :string, :null => false
+      t.column :quantity, :integer, :null => false, :default => 0
+      t.column :price, :decimal, :precision => 8, :scale =>2, :default => 0
+    end
+  end
+end