]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/054_refactor_map_bug_tables.rb
Standardise on double quoted strings
[rails.git] / db / migrate / 054_refactor_map_bug_tables.rb
index 6d259d20aae11e86d55d8b66d35174eefc7c8543..70ed81e452e6f082e5f5ea29779792eba6798ac2 100644 (file)
@@ -1,11 +1,10 @@
-require 'lib/migrate'
+require "migrate"
 
 class RefactorMapBugTables < ActiveRecord::Migration
   def self.up
     create_table :map_bug_comment do |t|
-      t.column :id, :bigint, :null => false
       t.column :bug_id, :bigint, :null => false
-      t.boolean :visible, :null => false 
+      t.boolean :visible, :null => false
       t.datetime :date_created, :null => false
       t.string :commenter_name
       t.string :commenter_ip
@@ -13,17 +12,19 @@ class RefactorMapBugTables < ActiveRecord::Migration
       t.string :comment
     end
 
-    remove_column :map_bugs, :text 
+    remove_column :map_bugs, :text
+
+    change_column :map_bug_comment, :id, :bigint
 
     add_index :map_bug_comment, [:bug_id], :name => "map_bug_comment_id_idx"
 
-    add_foreign_key :map_bug_comment, [:bug_id], :map_bugs, [:id]
-    add_foreign_key :map_bug_comment, [:commenter_id], :users, [:id]
+    add_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
+    add_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
   end
 
   def self.down
-    remove_foreign_key :map_bug_comment, [:commenter_id]
-    remove_foreign_key :map_bug_comment, [:bug_id]
+    remove_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
+    remove_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
 
     remove_index :map_bugs, :name => "map_bug_comment_id_idx"