]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/20120318201948_create_redactions.rb
Fix jshint warning
[rails.git] / db / migrate / 20120318201948_create_redactions.rb
index b6ee96037948205745635aca949a9e4d73da76db..bb9786db45f65bd849bba5a934eb37517108439b 100644 (file)
@@ -1,7 +1,7 @@
-require 'migrate'
+require "migrate"
 
 class CreateRedactions < ActiveRecord::Migration
-  def up
+  def change
     create_table :redactions do |t|
       t.string :title
       t.text :description
@@ -11,16 +11,7 @@ class CreateRedactions < ActiveRecord::Migration
 
     [:nodes, :ways, :relations].each do |tbl|
       add_column tbl, :redaction_id, :integer, :null => true
-      add_foreign_key tbl, [:redaction_id], :redactions, [:id]
+      add_foreign_key tbl, :redactions, :name => "#{tbl}_redaction_id_fkey"
     end
   end
-
-  def down
-    [:nodes, :ways, :relations].each do |tbl|
-      remove_foreign_key tbl, [:redaction_id], :redactions, [:id]
-      remove_column tbl, :redaction_id
-    end
-
-    drop_table :redactions
-  end
 end