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