1 class RefactorMapBugTables < ActiveRecord::Migration[4.2]
3 create_table :map_bug_comment do |t|
4 t.column :bug_id, :bigint, :null => false
5 t.boolean :visible, :null => false
6 t.datetime :date_created, :null => false
7 t.string :commenter_name
9 t.column :commenter_id, :bigint
13 remove_column :map_bugs, :text
15 change_column :map_bug_comment, :id, :bigint
17 add_index :map_bug_comment, [:bug_id], :name => "map_bug_comment_id_idx"
19 add_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
20 add_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
24 remove_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
25 remove_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
27 remove_index :map_bugs, :name => "map_bug_comment_id_idx"
29 add_column :map_bugs, :text, :string
31 drop_table :map_bug_comment