5 SET client_encoding = 'UNICODE';
7 --------------------------------------------------------------------------------
9 --------------------------------------------------------------------------------
12 CREATE TABLE sfa_db_version (
13 version integer NOT NULL,
14 subversion integer NOT NULL DEFAULT 0
17 -- the migration scripts do not use the major 'version' number
18 -- so 5.0 sets subversion at 100
19 -- in case your database misses the site and persons tags feature,
20 -- you might wish to first upgrade to 4.3-rc16 before moving to some 5.0
21 -- or run the up script here
22 -- http://svn.planet-lab.org/svn/PLCAPI/branches/4.3/migrations/
24 INSERT INTO sfa_db_version (version, subversion) VALUES (1, 1);
26 --------------------------------------------------------------------------------
27 -- Aggregates and store procedures
28 --------------------------------------------------------------------------------
30 -- Like MySQL GROUP_CONCAT(), this function aggregates values into a
32 CREATE AGGREGATE array_accum (
34 basetype = anyelement,
41 record_id serial PRIMARY KEY ,
43 authority text NOT NULL,
48 date_created timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
49 last_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP
51 CREATE INDEX sfa_hrn_ids on sfa (hrn);
52 CREATE INDEX sfa_type_ids on sfa (type);
53 CREATE INDEX sfa_authority_ids on sfa (authority);
54 CREATE INDEX sfa_peer_authority_ids on sfa (peer_authority);
55 CREATE INDEX sfa_pointer_ids on sfa (pointer);