]> git.openstreetmap.org Git - rails.git/blob - db/migrate/001_create_osm_db.rb
Merge remote-tracking branch 'upstream/pull/4717'
[rails.git] / db / migrate / 001_create_osm_db.rb
1 class CreateOsmDb < ActiveRecord::Migration[4.2]
2   def self.up
3     create_table "current_nodes", :id => false do |t|
4       t.column "id",        :bigint, :null => false
5       t.column "latitude",  :float, :limit => 53
6       t.column "longitude", :float, :limit => 53
7       t.column "user_id",   :bigint
8       t.column "visible",   :boolean
9       t.column "tags",      :text, :default => "", :null => false
10       t.column "timestamp", :datetime
11     end
12
13     add_index "current_nodes", ["id"], :name => "current_nodes_id_idx"
14     add_index "current_nodes", %w[latitude longitude], :name => "current_nodes_lat_lon_idx"
15     add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
16
17     create_table "current_segments", :id => false do |t|
18       t.column "id",        :bigint, :null => false
19       t.column "node_a",    :bigint
20       t.column "node_b",    :bigint
21       t.column "user_id",   :bigint
22       t.column "visible",   :boolean
23       t.column "tags",      :text, :default => "", :null => false
24       t.column "timestamp", :datetime
25     end
26
27     add_index "current_segments", %w[id visible], :name => "current_segments_id_visible_idx"
28     add_index "current_segments", ["node_a"], :name => "current_segments_a_idx"
29     add_index "current_segments", ["node_b"], :name => "current_segments_b_idx"
30
31     create_table "current_way_segments", :id => false do |t|
32       t.column "id",          :bigint
33       t.column "segment_id",  :bigint
34       t.column "sequence_id", :bigint
35     end
36
37     add_index "current_way_segments", ["segment_id"], :name => "current_way_segments_seg_idx"
38     add_index "current_way_segments", ["id"], :name => "current_way_segments_id_idx"
39
40     create_table "current_way_tags", :id => false do |t|
41       t.column "id", :bigint
42       t.column "k",  :string, :default => "", :null => false
43       t.column "v",  :string, :default => "", :null => false
44     end
45
46     add_index "current_way_tags", ["id"], :name => "current_way_tags_id_idx"
47     add_index "current_way_tags", "v", :name => "current_way_tags_v_idx"
48
49     create_table "current_ways", :id => false do |t|
50       t.column "id",        :bigserial, :primary_key => true, :null => false
51       t.column "user_id",   :bigint
52       t.column "timestamp", :datetime
53       t.column "visible",   :boolean
54     end
55
56     create_table "diary_entries", :id => false do |t|
57       t.column "id",         :bigserial, :primary_key => true, :null => false
58       t.column "user_id",    :bigint, :null => false
59       t.column "title",      :string
60       t.column "body",       :text
61       t.column "created_at", :datetime
62       t.column "updated_at", :datetime
63     end
64
65     create_table "friends", :id => false do |t|
66       t.column "id",             :bigserial, :primary_key => true, :null => false
67       t.column "user_id",        :bigint, :null => false
68       t.column "friend_user_id", :bigint, :null => false
69     end
70
71     add_index "friends", ["friend_user_id"], :name => "user_id_idx"
72
73     create_table "gps_points", :id => false do |t|
74       t.column "altitude",  :float
75       t.column "user_id",   :integer
76       t.column "trackid",   :integer
77       t.column "latitude",  :integer
78       t.column "longitude", :integer
79       t.column "gpx_id",    :integer
80       t.column "timestamp", :datetime
81     end
82
83     add_index "gps_points", %w[latitude longitude user_id], :name => "points_idx"
84     add_index "gps_points", ["user_id"], :name => "points_uid_idx"
85     add_index "gps_points", ["gpx_id"], :name => "points_gpxid_idx"
86
87     create_table "gpx_file_tags", :id => false do |t|
88       t.column "gpx_id", :bigint, :default => 0, :null => false
89       t.column "tag",    :string
90       t.column "id",     :bigserial, :primary_key => true, :null => false
91     end
92
93     add_index "gpx_file_tags", ["gpx_id"], :name => "gpx_file_tags_gpxid_idx"
94
95     create_table "gpx_files", :id => false do |t|
96       t.column "id",          :bigserial, :primary_key => true, :null => false
97       t.column "user_id",     :bigint
98       t.column "visible",     :boolean, :default => true, :null => false
99       t.column "name",        :string, :default => "", :null => false
100       t.column "size",        :bigint
101       t.column "latitude",    :float, :limit => 53
102       t.column "longitude",   :float, :limit => 53
103       t.column "timestamp",   :datetime
104       t.column "public",      :boolean, :default => true, :null => false
105       t.column "description", :string, :default => ""
106       t.column "inserted",    :boolean
107     end
108
109     add_index "gpx_files", ["timestamp"], :name => "gpx_files_timestamp_idx"
110     add_index "gpx_files", %w[visible public], :name => "gpx_files_visible_public_idx"
111
112     create_table "gpx_pending_files", :id => false do |t|
113       t.column "originalname", :string
114       t.column "tmpname",      :string
115       t.column "user_id",      :bigint
116     end
117
118     create_table "messages", :id => false do |t|
119       t.column "id",                :bigserial, :primary_key => true, :null => false
120       t.column "user_id",           :bigint, :null => false
121       t.column "from_user_id",      :bigint, :null => false
122       t.column "from_display_name", :string, :default => ""
123       t.column "title",             :string
124       t.column "body",              :text
125       t.column "sent_on",           :datetime
126       t.column "message_read",      :boolean, :default => false
127       t.column "to_user_id",        :bigint, :null => false
128     end
129
130     add_index "messages", ["from_display_name"], :name => "from_name_idx"
131
132     create_table "meta_areas", :id => false do |t|
133       t.column "id",        :bigserial, :primary_key => true, :null => false
134       t.column "user_id",   :bigint
135       t.column "timestamp", :datetime
136     end
137
138     create_table "nodes", :id => false do |t|
139       t.column "id",        :bigint
140       t.column "latitude",  :float, :limit => 53
141       t.column "longitude", :float, :limit => 53
142       t.column "user_id",   :bigint
143       t.column "visible",   :boolean
144       t.column "tags",      :text, :default => "", :null => false
145       t.column "timestamp", :datetime
146     end
147
148     add_index "nodes", ["id"], :name => "nodes_uid_idx"
149     add_index "nodes", %w[latitude longitude], :name => "nodes_latlon_idx"
150
151     create_table "segments", :id => false do |t|
152       t.column "id",        :bigint
153       t.column "node_a",    :bigint
154       t.column "node_b",    :bigint
155       t.column "user_id",   :bigint
156       t.column "visible",   :boolean
157       t.column "tags",      :text, :default => "", :null => false
158       t.column "timestamp", :datetime
159     end
160
161     add_index "segments", ["node_a"], :name => "street_segments_nodea_idx"
162     add_index "segments", ["node_b"], :name => "street_segments_nodeb_idx"
163     add_index "segments", ["id"], :name => "street_segment_uid_idx"
164
165     create_table "users", :id => false do |t|
166       t.column "email",         :string
167       t.column "id",            :bigserial, :primary_key => true, :null => false
168       t.column "token",         :string
169       t.column "active",        :integer, :default => 0, :null => false
170       t.column "pass_crypt",    :string
171       t.column "creation_time", :datetime
172       t.column "timeout",       :datetime
173       t.column "display_name",  :string, :default => ""
174       t.column "preferences",   :text
175       t.column "data_public",   :boolean, :default => false
176       t.column "description",   :text, :default => "", :null => false
177       t.column "home_lat",      :float, :limit => 53, :default => 1
178       t.column "home_lon",      :float, :limit => 53, :default => 1
179       t.column "within_lon",    :float, :limit => 53
180       t.column "within_lat",    :float, :limit => 53
181       t.column "home_zoom",     :integer, :limit => 2, :default => 3
182     end
183
184     add_index "users", ["email"], :name => "users_email_idx"
185     add_index "users", ["display_name"], :name => "users_display_name_idx"
186
187     create_table "way_segments", :id => false do |t|
188       t.column "id",          :bigint, :default => 0, :null => false
189       t.column "segment_id",  :integer
190       t.column "version",     :bigint, :default => 0, :null => false
191       t.column "sequence_id", :bigint, :null => false
192     end
193
194     add_primary_key "way_segments", %w[id version sequence_id]
195
196     create_table "way_tags", :id => false do |t|
197       t.column "id",      :bigint, :default => 0, :null => false
198       t.column "k",       :string
199       t.column "v",       :string
200       t.column "version", :bigint
201     end
202
203     add_index "way_tags", %w[id version], :name => "way_tags_id_version_idx"
204
205     create_table "ways", :id => false do |t|
206       t.column "id",        :bigint, :default => 0, :null => false
207       t.column "user_id",   :bigint
208       t.column "timestamp", :datetime
209       t.column "version",   :bigint, :null => false
210       t.column "visible",   :boolean, :default => true
211     end
212
213     add_primary_key "ways", %w[id version]
214     add_index "ways", ["id"], :name => "ways_id_version_idx"
215   end
216
217   def self.down; end
218 end