]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/XXXX.geosort.sql
lp1863252 toward geosort
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / XXXX.geosort.sql
1 BEGIN;
2
3 -- check whether patch can be applied
4 SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
5
6 -- 005.schema.actors.sql
7
8 -- CREATE TABLE actor.org_address (
9 --     ...
10 --     latitude    FLOAT,
11 --     longitude   FLOAT
12 -- );
13
14 ALTER TABLE actor.org_address ADD COLUMN latitude FLOAT;
15 ALTER TABLE actor.org_address ADD COLUMN longitude FLOAT;
16
17 -- 002.schema.config.sql
18
19 CREATE TABLE config.geolocation_service (
20     id           SERIAL PRIMARY KEY,
21     active       BOOLEAN,
22     owner        INT NOT NULL, -- REFERENCES actor.org_unit (id)
23     name         TEXT,
24     service_code TEXT,
25     api_key      TEXT
26 );
27
28 -- 800.fkeys.sql
29
30 ALTER TABLE config.geolocation_service ADD CONSTRAINT cgs_owner_fkey
31     FOREIGN KEY (owner) REFERENCES  actor.org_unit(id) DEFERRABLE INITIALLY DEFERRED;
32
33 -- 950.data.seed-values.sql
34
35 INSERT INTO config.global_flag (name, value, enabled, label)
36 VALUES (
37     'opac.use_geolocation',
38     NULL,
39     FALSE,
40     oils_i18n_gettext(
41         'opac.use_geolocation',
42         'Offer use of geographic location services in the public catalog',
43         'cgf', 'label'
44     )
45 );
46
47 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
48 VALUES (
49     'opac.holdings_sort_by_geographic_proximity',
50     oils_i18n_gettext('opac.holdings_sort_by_geographic_proximity',
51         'Enable Holdings Sort by Geographic Proximity',
52         'coust', 'label'),
53     'opac',
54     oils_i18n_gettext('opac.holdings_sort_by_geographic_proximity',
55         'When set to TRUE, will cause the record details page to display the controls for sorting holdings by geographic proximity. This also depends on the global flag opac.use_geolocation being enabled.',
56         'coust', 'description'),
57     'bool'
58 );
59
60 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
61 VALUES (
62     'opac.geographic_proximity_in_miles',
63     oils_i18n_gettext('opac.geographic_proximity_in_miles',
64         'Show Geographic Proximity in Miles',
65         'coust', 'label'),
66     'opac',
67     oils_i18n_gettext('opac.geographic_proximity_in_miles',
68         'When set to TRUE, will cause the record details page to show distances for geographic proximity in miles instead of kilometers.',
69         'coust', 'description'),
70     'bool'
71 );
72
73 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype, fm_class)
74 VALUES (
75     'opac.geographic_location_service_for_address',
76     oils_i18n_gettext('opac.geographic_location_service_for_address',
77         'Geographic Location Service to use for Addresses',
78         'coust', 'label'),
79     'opac',
80     oils_i18n_gettext('opac.geographic_location_service_for_address',
81         'Specifies which geographic location service to use for converting address input to geographic coordinates.',
82         'coust', 'description'),
83     'link', 'cgs'
84 );
85
86 INSERT INTO permission.perm_list ( id, code, description ) VALUES
87  ( 630, 'VIEW_GEOLOCATION_SERVICES', oils_i18n_gettext(630,
88     'View geographic location services', 'ppl', 'description')),
89  ( 631, 'ADMIN_GEOLOCATION_SERVICES', oils_i18n_gettext(631,
90     'Administer geographic location services', 'ppl', 'description'))
91 ;
92
93 COMMIT;