]> git.openstreetmap.org Git - rails.git/blob - db/README
Cleanup migrations
[rails.git] / db / README
1 Creating database
2 ===================
3
4 OSM server uses a Postgres database with the following name:
5
6 openstreetmap
7
8 You may create it with your preferable client or run next (linux) command:
9
10 $ createdb openstreetmap
11
12 Creating functions for PgSQL
13 ==============================
14
15 Run this command in the db/functions directory:
16
17 $ make libpgosm.so
18
19 You might also need to install:
20 - postgresql development libraries:     $ sudo apt-get install postgresql-server-dev-8.3
21 - ruby development libraries:           $ sudo apt-get install ruby1.8-dev
22 for build to succeed.
23
24 Now create the function as follows:
25
26 $ psql openstreetmap
27 (This may need authentication or a -u <dbowneruid>)
28
29 > CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4 
30   AS '/path/to/rails-port/db/functions/libpgosm.so', 'maptile_for_point'
31   LANGUAGE C STRICT;
32
33 Creating database skeleton tables
34 ===================================
35
36 Run this command from the root of your rails directory:
37
38 $ rake db:migrate
39
40 This will create the db for you
41
42 You will need to make sure the database connection is configured in database.yml in config directory
43 You might start with example configuration provided: 
44 $ cp config/example.database.yml config/database.yml