Reputation: 1763
My database.yml development section looks like this:
development:
adapter: postgis
encoding: unicode
database: openData_development
pool: 5
username: postgres
password: test1234
schema_search_path: "public,postgis"
script_dir: C:\Program Files (x86)\PostgreSQL\9.2\share\contrib\postgis-2.0
rake db:create worked, the openData_development schema was created. but i cant use postgis...
If i want to create a table like:
CREATE TABLE bezirks (
id integer NOT NULL,
name character varying(255),
beznr integer,
district_code integer,
main_id integer NOT NULL,
latlon geometry,
CONSTRAINT enforce_dims_latlon CHECK ((st_ndims(latlon) = 2)),
CONSTRAINT enforce_geotype_latlon CHECK (((geometrytype(latlon) = 'MULTIPOLYGON'::text) OR (latlon IS NULL))),
CONSTRAINT enforce_srid_latlon CHECK ((st_srid(latlon) = 4326))
);
I get the error:
ERROR: Type »geometry« doesnt exist
LINE 27: latlon geometry,
Upvotes: 0
Views: 340
Reputation: 12564
using the postgis adapter does not automagically install the postgis extensions on your db.
You have to do it yourself ; one solution to help automation of this is to create a 'bare' db on your server named 'template_postgis', install the postgis extensions on it as you would usually do (follow the installation guide on postgis website), and then add this to your database.yml:
development:
template: template_postgis
do it on every dbs so rails will create them as a copy of this template.
Upvotes: 1