3 class CreateOsmDb < ActiveRecord::Migration
5 create_table "current_nodes", innodb_table do |t|
6 t.column "id", :bigint, :limit => 64, :null => false
7 t.column "latitude", :double
8 t.column "longitude", :double
9 t.column "user_id", :bigint, :limit => 20
10 t.column "visible", :boolean
11 t.column "tags", :text, :default => "", :null => false
12 t.column "timestamp", :datetime
15 add_index "current_nodes", ["id"], :name => "current_nodes_id_idx"
16 add_index "current_nodes", ["latitude", "longitude"], :name => "current_nodes_lat_lon_idx"
17 add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
19 change_column "current_nodes", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
21 create_table "current_segments", innodb_table do |t|
22 t.column "id", :bigint, :limit => 64, :null => false
23 t.column "node_a", :bigint, :limit => 64
24 t.column "node_b", :bigint, :limit => 64
25 t.column "user_id", :bigint, :limit => 20
26 t.column "visible", :boolean
27 t.column "tags", :text, :default => "", :null => false
28 t.column "timestamp", :datetime
31 add_index "current_segments", ["id", "visible"], :name => "current_segments_id_visible_idx"
32 add_index "current_segments", ["node_a"], :name => "current_segments_a_idx"
33 add_index "current_segments", ["node_b"], :name => "current_segments_b_idx"
35 change_column "current_segments", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
37 create_table "current_way_segments", innodb_table do |t|
38 t.column "id", :bigint, :limit => 64
39 t.column "segment_id", :bigint, :limit => 11
40 t.column "sequence_id", :bigint, :limit => 11
43 add_index "current_way_segments", ["segment_id"], :name => "current_way_segments_seg_idx"
44 add_index "current_way_segments", ["id"], :name => "current_way_segments_id_idx"
46 create_table "current_way_tags", myisam_table do |t|
47 t.column "id", :bigint, :limit => 64
48 t.column "k", :string, :default => "", :null => false
49 t.column "v", :string, :default => "", :null => false
52 add_index "current_way_tags", ["id"], :name => "current_way_tags_id_idx"
53 execute "CREATE FULLTEXT INDEX `current_way_tags_v_idx` ON `current_way_tags` (`v`)"
55 create_table "current_ways", myisam_table do |t|
56 t.column "id", :bigint, :limit => 64, :null => false
57 t.column "user_id", :bigint, :limit => 20
58 t.column "timestamp", :datetime
59 t.column "visible", :boolean
62 add_primary_key "current_ways", ["id"]
64 change_column "current_ways", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
66 create_table "diary_entries", myisam_table do |t|
67 t.column "id", :bigint, :limit => 20, :null => false
68 t.column "user_id", :bigint, :limit => 20, :null => false
69 t.column "title", :string
70 t.column "body", :text
71 t.column "created_at", :datetime
72 t.column "updated_at", :datetime
75 add_primary_key "diary_entries", ["id"]
77 change_column "diary_entries", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
79 create_table "friends", myisam_table do |t|
80 t.column "id", :bigint, :limit => 20, :null => false
81 t.column "user_id", :bigint, :limit => 20, :null => false
82 t.column "friend_user_id", :bigint, :limit => 20, :null => false
85 add_primary_key "friends", ["id"]
86 add_index "friends", ["friend_user_id"], :name => "user_id_idx"
88 change_column "friends", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
90 create_table "gps_points", myisam_table do |t|
91 t.column "altitude", :float
92 t.column "user_id", :integer, :limit => 20
93 t.column "trackid", :integer
94 t.column "latitude", :integer
95 t.column "longitude", :integer
96 t.column "gpx_id", :integer, :limit => 20
97 t.column "timestamp", :datetime
100 add_index "gps_points", ["latitude", "longitude", "user_id"], :name => "points_idx"
101 add_index "gps_points", ["user_id"], :name => "points_uid_idx"
102 add_index "gps_points", ["gpx_id"], :name => "points_gpxid_idx"
104 create_table "gpx_file_tags", myisam_table do |t|
105 t.column "gpx_id", :bigint, :limit => 64, :default => 0, :null => false
106 t.column "tag", :string
107 t.column "id", :integer, :limit => 20, :null => false
110 add_primary_key "gpx_file_tags", ["id"]
111 add_index "gpx_file_tags", ["gpx_id"], :name => "gpx_file_tags_gpxid_idx"
113 change_column "gpx_file_tags", "id", :integer, :null => false, :options => "AUTO_INCREMENT"
115 create_table "gpx_files", myisam_table do |t|
116 t.column "id", :bigint, :limit => 64, :null => false
117 t.column "user_id", :bigint, :limit => 20
118 t.column "visible", :boolean, :default => true, :null => false
119 t.column "name", :string, :default => "", :null => false
120 t.column "size", :bigint, :limit => 20
121 t.column "latitude", :double
122 t.column "longitude", :double
123 t.column "timestamp", :datetime
124 t.column "public", :boolean, :default => true, :null => false
125 t.column "description", :string, :default => ""
126 t.column "inserted", :boolean
129 add_primary_key "gpx_files", ["id"]
130 add_index "gpx_files", ["timestamp"], :name => "gpx_files_timestamp_idx"
131 add_index "gpx_files", ["visible", "public"], :name => "gpx_files_visible_public_idx"
133 change_column "gpx_files", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
135 create_table "gpx_pending_files", myisam_table do |t|
136 t.column "originalname", :string
137 t.column "tmpname", :string
138 t.column "user_id", :bigint, :limit => 20
141 create_table "messages", myisam_table do |t|
142 t.column "id", :bigint, :limit => 20, :null => false
143 t.column "user_id", :bigint, :limit => 20, :null => false
144 t.column "from_user_id", :bigint, :limit => 20, :null => false
145 t.column "from_display_name", :string, :default => ""
146 t.column "title", :string
147 t.column "body", :text
148 t.column "sent_on", :datetime
149 t.column "message_read", :boolean, :default => false
150 t.column "to_user_id", :bigint, :limit => 20, :null => false
153 add_primary_key "messages", ["id"]
154 add_index "messages", ["from_display_name"], :name => "from_name_idx"
156 change_column "messages", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
158 create_table "meta_areas", myisam_table do |t|
159 t.column "id", :bigint, :limit => 64, :null => false
160 t.column "user_id", :bigint, :limit => 20
161 t.column "timestamp", :datetime
164 add_primary_key "meta_areas", ["id"]
166 change_column "meta_areas", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
168 create_table "nodes", myisam_table do |t|
169 t.column "id", :bigint, :limit => 64
170 t.column "latitude", :double
171 t.column "longitude", :double
172 t.column "user_id", :bigint, :limit => 20
173 t.column "visible", :boolean
174 t.column "tags", :text, :default => "", :null => false
175 t.column "timestamp", :datetime
178 add_index "nodes", ["id"], :name => "nodes_uid_idx"
179 add_index "nodes", ["latitude", "longitude"], :name => "nodes_latlon_idx"
181 create_table "segments", myisam_table do |t|
182 t.column "id", :bigint, :limit => 64
183 t.column "node_a", :bigint, :limit => 64
184 t.column "node_b", :bigint, :limit => 64
185 t.column "user_id", :bigint, :limit => 20
186 t.column "visible", :boolean
187 t.column "tags", :text, :default => "", :null => false
188 t.column "timestamp", :datetime
191 add_index "segments", ["node_a"], :name => "street_segments_nodea_idx"
192 add_index "segments", ["node_b"], :name => "street_segments_nodeb_idx"
193 add_index "segments", ["id"], :name => "street_segment_uid_idx"
195 create_table "users", innodb_table do |t|
196 t.column "email", :string
197 t.column "id", :bigint, :limit => 20, :null => false
198 t.column "token", :string
199 t.column "active", :integer, :default => 0, :null => false
200 t.column "pass_crypt", :string
201 t.column "creation_time", :datetime
202 t.column "timeout", :datetime
203 t.column "display_name", :string, :default => ""
204 t.column "preferences", :text
205 t.column "data_public", :boolean, :default => false
206 t.column "description", :text, :default => "", :null => false
207 t.column "home_lat", :double, :default => 1
208 t.column "home_lon", :double, :default => 1
209 t.column "within_lon", :double
210 t.column "within_lat", :double
211 t.column "home_zoom", :integer, :limit => 2, :default => 3
214 add_primary_key "users", ["id"]
215 add_index "users", ["email"], :name => "users_email_idx"
216 add_index "users", ["display_name"], :name => "users_display_name_idx"
218 change_column "users", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
220 create_table "way_segments", myisam_table do |t|
221 t.column "id", :bigint, :limit => 64, :default => 0, :null => false
222 t.column "segment_id", :integer
223 t.column "version", :bigint, :limit => 20, :default => 0, :null => false
224 t.column "sequence_id", :bigint, :limit => 11, :null => false
227 add_primary_key "way_segments", ["id", "version", "sequence_id"]
229 change_column "way_segments", "sequence_id", :bigint, :limit => 11, :null => false, :options => "AUTO_INCREMENT"
231 create_table "way_tags", myisam_table do |t|
232 t.column "id", :bigint, :limit => 64, :default => 0, :null => false
233 t.column "k", :string
234 t.column "v", :string
235 t.column "version", :bigint, :limit => 20
238 add_index "way_tags", ["id", "version"], :name => "way_tags_id_version_idx"
240 create_table "ways", myisam_table do |t|
241 t.column "id", :bigint, :limit => 64, :default => 0, :null => false
242 t.column "user_id", :bigint, :limit => 20
243 t.column "timestamp", :datetime
244 t.column "version", :bigint, :limit => 20, :null => false
245 t.column "visible", :boolean, :default => true
248 add_primary_key "ways", ["id", "version"]
249 add_index "ways", ["id"], :name => "ways_id_version_idx"
251 change_column "ways", "version", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"