| OLD | NEW |
| (Empty) |
| 1 class AddPhotosTable < ActiveRecord::Migration | |
| 2 def self.up | |
| 3 create_table :photos do |t| | |
| 4 t.column :news_item_id, :integer | |
| 5 t.column :image, :string | |
| 6 t.column :description, :string | |
| 7 t.column :created_at, :datetime | |
| 8 t.column :updated_at, :datetime | |
| 9 t.column :created_by_id, :integer | |
| 10 t.column :updated_by_id, :integer | |
| 11 end | |
| 12 | |
| 13 create_table :tags do |t| | |
| 14 t.column :name, :string | |
| 15 end | |
| 16 | |
| 17 create_table :tags_news_items, :id => false do |t| | |
| 18 t.column :tag_id, :integer | |
| 19 t.column :news_item_id, :integer | |
| 20 end | |
| 21 | |
| 22 create_table :tags_photos, :id => false do |t| | |
| 23 t.column :tag_id, :integer | |
| 24 t.column :photo_id, :integer | |
| 25 end | |
| 26 | |
| 27 add_column :news_items, :updated_at, :datetime | |
| 28 end | |
| 29 | |
| 30 def self.down | |
| 31 remove_column :news_items, :updated_at | |
| 32 | |
| 33 drop_table :tags_photos | |
| 34 drop_table :tags_news_items | |
| 35 drop_table :tags | |
| 36 drop_table :photos | |
| 37 end | |
| 38 end | |
| OLD | NEW |