]> git.openstreetmap.org Git - rails.git/blob - db/migrate/053_add_map_bug_tables.rb
2d3b7348bd3d62bc953a51f1dc0ba935b667f488
[rails.git] / db / migrate / 053_add_map_bug_tables.rb
1 require 'lib/migrate'
2
3 class AddMapBugTables < ActiveRecord::Migration
4   def self.up
5
6         create_enumeration :map_bug_status_enum, ["open", "closed","hidden"]
7
8     create_table :map_bugs do |t|
9       t.column :id, :bigint, :null => false 
10       t.integer :latitude, :null => false 
11       t.integer :longitude, :null => false 
12       t.column :tile, :bigint, :null => false
13       t.datetime :last_changed, :null => false
14       t.datetime :date_created, :null => false 
15       t.string :nearby_place 
16       t.string :text
17           t.column :status, :map_bug_status_enum, :null => false
18           
19     end
20
21     add_index :map_bugs, [:tile,:status], :name => "map_bugs_tile_idx"
22         add_index :map_bugs, [:last_changed], :name => "map_bugs_changed_idx"
23         add_index :map_bugs, [:date_created], :name => "map_bugs_created_idx"
24   end
25
26   def self.down
27     remove_index :map_bugs, :name => "map_bugs_tile_idx"
28         remove_index :map_bugs, :name => "map_bugs_changed_idx"
29         remove_index :map_bugs, :name => "map_bugs_created_idx"
30     drop_table :map_bugs
31         drop_enumeration :map_bug_status_enum
32   end
33 end