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