]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/20120318201948_create_redactions.rb
Fix rubocop warnings
[rails.git] / db / migrate / 20120318201948_create_redactions.rb
index bcb3929cb65590a41345c30bb35091446a523119..8a1cf6bf302a0af0c2ca3077a001b94a23b5d0dd 100644 (file)
@@ -1,26 +1,17 @@
-require 'migrate'
+require "migrate"
 
 class CreateRedactions < ActiveRecord::Migration
-  def up
+  def change
     create_table :redactions do |t|
       t.string :title
       t.text :description
 
-      t.timestamps
+      t.timestamps :null => true
     end
 
     [: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