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