3 class CreateOsmDb < ActiveRecord::Migration
5 myisam_table = { :id => false, :force => true, :options => "ENGINE=MyIsam DEFAULT CHARSET=utf8" }
6 innodb_table = { :id => false, :force => true, :options => "ENGINE=InnoDB DEFAULT CHARSET=utf8" }
8 create_table "current_nodes", innodb_table do |t|
9 t.column "id", :bigint, :limit => 64, :null => false
10 t.column "latitude", :double
11 t.column "longitude", :double
12 t.column "user_id", :bigint, :limit => 20
13 t.column "visible", :boolean
14 t.column "tags", :text, :default => "", :null => false
15 t.column "timestamp", :datetime
18 add_index "current_nodes", ["id"], :name => "current_nodes_id_idx"
19 add_index "current_nodes", ["latitude", "longitude"], :name => "current_nodes_lat_lon_idx"
20 add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
22 change_column "current_nodes", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
24 create_table "current_segments", innodb_table do |t|
25 t.column "id", :bigint, :limit => 64, :null => false
26 t.column "node_a", :bigint, :limit => 64
27 t.column "node_b", :bigint, :limit => 64
28 t.column "user_id", :bigint, :limit => 20
29 t.column "visible", :boolean
30 t.column "tags", :text, :default => "", :null => false
31 t.column "timestamp", :datetime
34 add_index "current_segments", ["id", "visible"], :name => "current_segments_id_visible_idx"
35 add_index "current_segments", ["node_a"], :name => "current_segments_a_idx"
36 add_index "current_segments", ["node_b"], :name => "current_segments_b_idx"
38 change_column "current_segments", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
40 create_table "current_way_segments", innodb_table do |t|
41 t.column "id", :bigint, :limit => 64
42 t.column "segment_id", :bigint, :limit => 11
43 t.column "sequence_id", :bigint, :limit => 11
46 add_index "current_way_segments", ["segment_id"], :name => "current_way_segments_seg_idx"
47 add_index "current_way_segments", ["id"], :name => "current_way_segments_id_idx"
49 create_table "current_way_tags", myisam_table do |t|
50 t.column "id", :bigint, :limit => 64
51 t.column "k", :string, :default => "", :null => false
52 t.column "v", :string, :default => "", :null => false
55 add_index "current_way_tags", ["id"], :name => "current_way_tags_id_idx"
56 execute "CREATE FULLTEXT INDEX `current_way_tags_v_idx` ON `current_way_tags` (`v`)"
58 create_table "current_ways", myisam_table do |t|
59 t.column "id", :bigint, :limit => 64, :null => false
60 t.column "user_id", :bigint, :limit => 20
61 t.column "timestamp", :datetime
62 t.column "visible", :boolean
65 add_primary_key "current_ways", ["id"]
67 change_column "current_ways", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
69 create_table "diary_entries", myisam_table do |t|
70 t.column "id", :bigint, :limit => 20, :null => false
71 t.column "user_id", :bigint, :limit => 20, :null => false
72 t.column "title", :string
73 t.column "body", :text
74 t.column "created_at", :datetime
75 t.column "updated_at", :datetime
78 add_primary_key "diary_entries", ["id"]
80 change_column "diary_entries", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
82 create_table "friends", myisam_table do |t|
83 t.column "id", :bigint, :limit => 20, :null => false
84 t.column "user_id", :bigint, :limit => 20, :null => false
85 t.column "friend_user_id", :bigint, :limit => 20, :null => false
88 add_primary_key "friends", ["id"]
89 add_index "friends", ["friend_user_id"], :name => "user_id_idx"
91 change_column "friends", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
93 create_table "gps_points", myisam_table do |t|
94 t.column "altitude", :float
95 t.column "user_id", :integer, :limit => 20
96 t.column "trackid", :integer
97 t.column "latitude", :integer
98 t.column "longitude", :integer
99 t.column "gpx_id", :integer, :limit => 20
100 t.column "timestamp", :datetime
103 add_index "gps_points", ["latitude", "longitude", "user_id"], :name => "points_idx"
104 add_index "gps_points", ["user_id"], :name => "points_uid_idx"
105 add_index "gps_points", ["gpx_id"], :name => "points_gpxid_idx"
107 create_table "gpx_file_tags", myisam_table do |t|
108 t.column "gpx_id", :bigint, :limit => 64, :default => 0, :null => false
109 t.column "tag", :string
110 t.column "id", :integer, :limit => 20, :null => false
113 add_primary_key "gpx_file_tags", ["id"]
114 add_index "gpx_file_tags", ["gpx_id"], :name => "gpx_file_tags_gpxid_idx"
116 change_column "gpx_file_tags", "id", :integer, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
118 create_table "gpx_files", myisam_table do |t|
119 t.column "id", :bigint, :limit => 64, :null => false
120 t.column "user_id", :bigint, :limit => 20
121 t.column "visible", :boolean, :default => true, :null => false
122 t.column "name", :string, :default => "", :null => false
123 t.column "size", :bigint, :limit => 20
124 t.column "latitude", :double
125 t.column "longitude", :double
126 t.column "timestamp", :datetime
127 t.column "public", :boolean, :default => true, :null => false
128 t.column "description", :string, :default => ""
129 t.column "inserted", :boolean
132 add_primary_key "gpx_files", ["id"]
133 add_index "gpx_files", ["timestamp"], :name => "gpx_files_timestamp_idx"
134 add_index "gpx_files", ["visible", "public"], :name => "gpx_files_visible_public_idx"
136 change_column "gpx_files", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
138 create_table "gpx_pending_files", myisam_table do |t|
139 t.column "originalname", :string
140 t.column "tmpname", :string
141 t.column "user_id", :bigint, :limit => 20
144 create_table "messages", myisam_table do |t|
145 t.column "id", :bigint, :limit => 20, :null => false
146 t.column "user_id", :bigint, :limit => 20, :null => false
147 t.column "from_user_id", :bigint, :limit => 20, :null => false
148 t.column "from_display_name", :string, :default => ""
149 t.column "title", :string
150 t.column "body", :text
151 t.column "sent_on", :datetime
152 t.column "message_read", :boolean, :default => false
153 t.column "to_user_id", :bigint, :limit => 20, :null => false
156 add_primary_key "messages", ["id"]
157 add_index "messages", ["from_display_name"], :name => "from_name_idx"
159 change_column "messages", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
161 create_table "meta_areas", myisam_table do |t|
162 t.column "id", :bigint, :limit => 64, :null => false
163 t.column "user_id", :bigint, :limit => 20
164 t.column "timestamp", :datetime
167 add_primary_key "meta_areas", ["id"]
169 change_column "meta_areas", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
171 create_table "nodes", myisam_table do |t|
172 t.column "id", :bigint, :limit => 64
173 t.column "latitude", :double
174 t.column "longitude", :double
175 t.column "user_id", :bigint, :limit => 20
176 t.column "visible", :boolean
177 t.column "tags", :text, :default => "", :null => false
178 t.column "timestamp", :datetime
181 add_index "nodes", ["id"], :name => "nodes_uid_idx"
182 add_index "nodes", ["latitude", "longitude"], :name => "nodes_latlon_idx"
184 create_table "segments", myisam_table do |t|
185 t.column "id", :bigint, :limit => 64
186 t.column "node_a", :bigint, :limit => 64
187 t.column "node_b", :bigint, :limit => 64
188 t.column "user_id", :bigint, :limit => 20
189 t.column "visible", :boolean
190 t.column "tags", :text, :default => "", :null => false
191 t.column "timestamp", :datetime
194 add_index "segments", ["node_a"], :name => "street_segments_nodea_idx"
195 add_index "segments", ["node_b"], :name => "street_segments_nodeb_idx"
196 add_index "segments", ["id"], :name => "street_segment_uid_idx"
198 create_table "users", innodb_table do |t|
199 t.column "email", :string
200 t.column "id", :bigint, :limit => 20, :null => false
201 t.column "token", :string
202 t.column "active", :integer, :default => 0, :null => false
203 t.column "pass_crypt", :string
204 t.column "creation_time", :datetime
205 t.column "timeout", :datetime
206 t.column "display_name", :string, :default => ""
207 t.column "preferences", :text
208 t.column "data_public", :boolean, :default => false
209 t.column "description", :text, :default => "", :null => false
210 t.column "home_lat", :double, :default => 1
211 t.column "home_lon", :double, :default => 1
212 t.column "within_lon", :double
213 t.column "within_lat", :double
214 t.column "home_zoom", :integer, :limit => 2, :default => 3
217 add_primary_key "users", ["id"]
218 add_index "users", ["email"], :name => "users_email_idx"
219 add_index "users", ["display_name"], :name => "users_display_name_idx"
221 change_column "users", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
223 create_table "way_segments", myisam_table do |t|
224 t.column "id", :bigint, :limit => 64, :default => 0, :null => false
225 t.column "segment_id", :integer
226 t.column "version", :bigint, :limit => 20, :default => 0, :null => false
227 t.column "sequence_id", :bigint, :limit => 11, :null => false
230 add_primary_key "way_segments", ["id", "version", "sequence_id"]
232 change_column "way_segments", "sequence_id", :bigint, :limit => 11, :null => false, :options => "AUTO_INCREMENT"
234 create_table "way_tags", myisam_table do |t|
235 t.column "id", :bigint, :limit => 64, :default => 0, :null => false
236 t.column "k", :string
237 t.column "v", :string
238 t.column "version", :bigint, :limit => 20
241 add_index "way_tags", ["id", "version"], :name => "way_tags_id_version_idx"
243 create_table "ways", myisam_table do |t|
244 t.column "id", :bigint, :limit => 64, :default => 0, :null => false
245 t.column "user_id", :bigint, :limit => 20
246 t.column "timestamp", :datetime
247 t.column "version", :bigint, :limit => 20, :null => false
248 t.column "visible", :boolean, :default => true
251 add_primary_key "ways", ["id", "version"]
252 add_index "ways", ["id"], :name => "ways_id_version_idx"
254 change_column "ways", "version", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"