Add redactions table and link it to history tables

This commit is contained in:
Matt Amos 2012-04-04 08:34:34 +01:00 committed by Tom Hughes
parent d7d317f694
commit 822759075c
2 changed files with 107 additions and 5 deletions

View file

@ -0,0 +1,26 @@
require 'migrate'
class CreateRedactions < ActiveRecord::Migration
def up
create_table :redactions do |t|
t.string :title
t.text :description
t.timestamps
end
[:nodes, :ways, :relations].each do |tbl|
add_column tbl, :redaction_id, :integer, :null => true
add_foreign_key tbl, [:redaction_id], :redactions, [:id]
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