1 # frozen_string_literal: true
 
   3 class RefactorMapBugTables < ActiveRecord::Migration[4.2]
 
   5     create_table :map_bug_comment do |t|
 
   6       t.column :bug_id, :bigint, :null => false
 
   7       t.boolean :visible, :null => false
 
   8       t.datetime :date_created, :null => false
 
   9       t.string :commenter_name
 
  10       t.string :commenter_ip
 
  11       t.column :commenter_id, :bigint
 
  15     remove_column :map_bugs, :text
 
  17     change_column :map_bug_comment, :id, :bigint
 
  19     add_index :map_bug_comment, [:bug_id], :name => "map_bug_comment_id_idx"
 
  21     add_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
 
  22     add_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
 
  26     remove_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
 
  27     remove_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
 
  29     remove_index :map_bugs, :name => "map_bug_comment_id_idx"
 
  31     add_column :map_bugs, :text, :string
 
  33     drop_table :map_bug_comment