922 lines
34 KiB
SQL
922 lines
34 KiB
SQL
--
|
|
-- You must install dblink first
|
|
-- cmd: psql -d dbname -f `locate dblink.sql`
|
|
-- and postgis support has been removed.
|
|
--
|
|
|
|
SET default_with_oids = false;
|
|
|
|
CREATE OR REPLACE VIEW metadata_users AS
|
|
SELECT t1.id, t1.username, t1.password, t1.usertype, t1.ts_created, t1.ts_last_login, t1.email, t1.realname, t1.unit, t1.address, t1.project, t1.phone, t1.salt, t1.activation
|
|
FROM dblink('host=localhost dbname=metadata user=gis password=gispassword'::text, 'select * from users'::text) t1(id integer, username character varying(100), password character(32), usertype character varying(100), ts_created timestamp without time zone, ts_last_login timestamp without time zone, email character varying(100), realname character varying(100), unit character varying(200), address character varying(250), project character varying(500), phone character varying(100), salt character varying(128), activation character varying(30));
|
|
ALTER TABLE metadata_users OWNER TO gis;
|
|
|
|
CREATE OR REPLACE VIEW users AS
|
|
SELECT * FROM metadata_users;
|
|
ALTER TABLE users OWNER TO gis;
|
|
|
|
CREATE OR REPLACE RULE delete_metadata_users AS
|
|
ON DELETE TO metadata_users DO INSTEAD SELECT dblink_exec('host=localhost dbname=metadata user=gis password=gispassword'::text, dblink_current_query()) AS dblink_exec;
|
|
|
|
CREATE OR REPLACE RULE insert_metadata_users AS
|
|
ON INSERT TO metadata_users DO INSTEAD SELECT dblink_exec('host=localhost dbname=metadata user=gis password=gispassword'::text, dblink_current_query()) AS dblink_exec;
|
|
|
|
CREATE OR REPLACE RULE update_metadata_users AS
|
|
ON UPDATE TO metadata_users DO INSTEAD SELECT dblink_exec('host=localhost dbname=metadata user=gis password=gispassword'::text, dblink_current_query()) AS dblink_exec;
|
|
|
|
|
|
CREATE OR REPLACE RULE delete_users AS
|
|
ON DELETE TO users DO INSTEAD DELETE FROM metadata_users
|
|
WHERE metadata_users.id = old.id;
|
|
|
|
CREATE OR REPLACE RULE insert_users AS
|
|
ON INSERT TO users DO INSTEAD INSERT INTO metadata_users (id, username, password, usertype, email, realname, unit, address, project, phone)
|
|
VALUES (new.id, new.username, new.password, new.usertype, new.email, new.realname, new.unit, new.address, new.project, new.phone);
|
|
|
|
CREATE OR REPLACE RULE update_users AS
|
|
ON UPDATE TO users DO INSTEAD UPDATE metadata_users SET password = new.password, usertype = new.usertype, email = new.email, realname = new.realname, unit = new.unit, address = new.address, project = new.project, phone = new.phone, ts_last_login = new.ts_last_login, salt = new.salt, activation = new.activation
|
|
WHERE metadata_users.id = new.id OR metadata_users.username::text = new.username::text;
|
|
|
|
|
|
--
|
|
-- metadata tables
|
|
--
|
|
|
|
CREATE TABLE metadata
|
|
(
|
|
uuid uuid NOT NULL,
|
|
title character varying(250) NOT NULL,
|
|
description text,
|
|
west real,
|
|
east real,
|
|
south real,
|
|
north real,
|
|
timebegin timestamp without time zone,
|
|
timeend timestamp without time zone,
|
|
id serial NOT NULL,
|
|
filesize real DEFAULT 0,
|
|
datatype integer NOT NULL DEFAULT 0,
|
|
citation text,
|
|
ts_created timestamp without time zone DEFAULT now(),
|
|
fileformat character varying(250),
|
|
projection character varying(200),
|
|
author character varying(250),
|
|
title_en character varying,
|
|
suppinfo text,
|
|
source character varying DEFAULT ''::character varying,
|
|
doi character varying NOT NULL DEFAULT ''::character varying,
|
|
CONSTRAINT metadata_pkey PRIMARY KEY (id),
|
|
CONSTRAINT metadata_uuid_key UNIQUE (uuid)
|
|
);
|
|
ALTER TABLE metadata OWNER TO gis;
|
|
|
|
CREATE TABLE category (
|
|
id integer NOT NULL,
|
|
code integer NOT NULL
|
|
);
|
|
ALTER TABLE category OWNER TO gis;
|
|
|
|
|
|
CREATE TABLE dataseries (
|
|
id integer NOT NULL,
|
|
sid integer NOT NULL
|
|
);
|
|
ALTER TABLE dataseries OWNER TO gis;
|
|
|
|
CREATE TABLE keyword (
|
|
id integer NOT NULL,
|
|
keyword character varying(100) NOT NULL,
|
|
keytype character varying(100),
|
|
ts_created timestamp without time zone DEFAULT now()
|
|
);
|
|
ALTER TABLE keyword OWNER TO gis;
|
|
|
|
CREATE TABLE onlineresource (
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
linkage character varying(500),
|
|
protocol character varying(200),
|
|
description character varying(250),
|
|
name character varying(200)
|
|
);
|
|
ALTER TABLE onlineresource OWNER TO gis;
|
|
CREATE SEQUENCE onlinesource_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE onlinesource_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE onlinesource_id_seq OWNED BY onlineresource.id;
|
|
|
|
--
|
|
-- system tables
|
|
--
|
|
|
|
CREATE TABLE datafeature (
|
|
id integer NOT NULL,
|
|
title character varying(200) NOT NULL,
|
|
description text NOT NULL,
|
|
detailurl character varying(200) NOT NULL,
|
|
imgtext character varying(200),
|
|
imgurl character varying(200) NOT NULL,
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL
|
|
);
|
|
ALTER TABLE public.datafeature OWNER TO gis;
|
|
CREATE SEQUENCE datafeature_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.datafeature_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE datafeature_id_seq OWNED BY datafeature.id;
|
|
|
|
CREATE TABLE datasetcd (
|
|
id integer NOT NULL,
|
|
title character varying(500) NOT NULL,
|
|
size real,
|
|
url character varying(1000),
|
|
img character varying(300) NOT NULL,
|
|
document character varying(500) NOT NULL,
|
|
descript text,
|
|
ts_created timestamp without time zone DEFAULT now(),
|
|
uuid uuid
|
|
);
|
|
ALTER TABLE public.datasetcd OWNER TO gis;
|
|
CREATE SEQUENCE datasetcd_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.datasetcd_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE datasetcd_id_seq OWNED BY datasetcd.id;
|
|
|
|
--
|
|
-- metadata supplement
|
|
--
|
|
|
|
CREATE TABLE categorycode (
|
|
code integer NOT NULL,
|
|
name character varying(100) NOT NULL,
|
|
definition character varying(300),
|
|
name_zh character varying(100)
|
|
);
|
|
ALTER TABLE public.categorycode OWNER TO gis;
|
|
|
|
CREATE TABLE datafile (
|
|
id integer NOT NULL,
|
|
dsid integer NOT NULL,
|
|
filename character varying NOT NULL,
|
|
filesize double precision DEFAULT 0 NOT NULL,
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
isdir integer DEFAULT 0 NOT NULL,
|
|
depth integer DEFAULT 0 NOT NULL
|
|
);
|
|
ALTER TABLE public.datafile OWNER TO gis;
|
|
CREATE SEQUENCE datafile_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE datafile_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE datafile_id_seq OWNED BY datafile.id;
|
|
|
|
CREATE TABLE dataset (
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
host character varying(50) DEFAULT 'ftp1.westgis.ac.cn'::character varying NOT NULL,
|
|
path character varying NOT NULL,
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL
|
|
);
|
|
ALTER TABLE dataset OWNER TO gis;
|
|
CREATE SEQUENCE dataset_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE dataset_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE dataset_id_seq OWNED BY dataset.id;
|
|
|
|
CREATE TABLE attachments
|
|
(
|
|
id serial NOT NULL,
|
|
filename character varying(100) NOT NULL,
|
|
filetype character varying(100),
|
|
filedesc character varying(200),
|
|
ts_created timestamp without time zone NOT NULL DEFAULT now(),
|
|
userid integer NOT NULL,
|
|
downtimes integer NOT NULL DEFAULT 0,
|
|
filesize integer NOT NULL DEFAULT 0,
|
|
realname character varying(100) NOT NULL DEFAULT ''::character varying,
|
|
CONSTRAINT attachments_pkey PRIMARY KEY (id),
|
|
-- CONSTRAINT attachments_userid_fkey FOREIGN KEY (userid)
|
|
-- REFERENCES users (id) MATCH SIMPLE
|
|
-- ON UPDATE NO ACTION ON DELETE NO ACTION
|
|
);
|
|
ALTER TABLE attachments OWNER TO gis;
|
|
|
|
CREATE TABLE mdattach
|
|
(
|
|
uuid uuid NOT NULL,
|
|
id integer NOT NULL,
|
|
CONSTRAINT mdattach_pkey PRIMARY KEY (uuid, id),
|
|
CONSTRAINT mdattach_id_fkey FOREIGN KEY (id)
|
|
REFERENCES attachments (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION ON DELETE CASCADE
|
|
);
|
|
ALTER TABLE mdattach OWNER TO gis;
|
|
|
|
--
|
|
-- metadata extended
|
|
--
|
|
|
|
CREATE TABLE comments (
|
|
id integer NOT NULL,
|
|
author character varying(200) NOT NULL,
|
|
email character varying(100) DEFAULT ''::character varying NOT NULL,
|
|
url character varying(200),
|
|
ip character varying(100),
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
content text NOT NULL,
|
|
agent character varying(255),
|
|
subscribe boolean DEFAULT true NOT NULL,
|
|
type character varying(20),
|
|
uuid uuid NOT NULL,
|
|
userid integer DEFAULT 0 NOT NULL
|
|
);
|
|
ALTER TABLE public.comments OWNER TO gis;
|
|
CREATE SEQUENCE comments_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.comments_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE comments_id_seq OWNED BY comments.id;
|
|
|
|
CREATE TABLE dataorder (
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
userid integer NOT NULL,
|
|
status integer DEFAULT 0 NOT NULL,
|
|
ts_approved timestamp without time zone,
|
|
id integer NOT NULL,
|
|
uuid uuid,
|
|
offlineappid integer DEFAULT (-1) NOT NULL,
|
|
onlineappid integer DEFAULT (-1) NOT NULL
|
|
);
|
|
ALTER TABLE public.dataorder OWNER TO gis;
|
|
|
|
|
|
--
|
|
-- TOC entry 216 (class 1259 OID 87960)
|
|
-- Dependencies: 2900 6
|
|
-- Name: emailtext; Type: TABLE; Schema: public; Owner: gis; Tablespace:
|
|
--
|
|
|
|
CREATE TABLE emailtext (
|
|
id integer NOT NULL,
|
|
subject character varying(200),
|
|
body text NOT NULL,
|
|
template character varying(100) NOT NULL,
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
ts_changed timestamp without time zone
|
|
);
|
|
ALTER TABLE public.emailtext OWNER TO gis;
|
|
CREATE SEQUENCE emailtext_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.emailtext_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE emailtext_id_seq OWNED BY emailtext.id;
|
|
|
|
CREATE TABLE ftpuser (
|
|
userid integer NOT NULL,
|
|
pwd character varying(50),
|
|
ts_created timestamp without time zone,
|
|
ts_invalid timestamp without time zone,
|
|
datacount integer DEFAULT 0 NOT NULL
|
|
);
|
|
ALTER TABLE public.ftpuser OWNER TO gis;
|
|
|
|
CREATE VIEW g6ftpusers AS
|
|
SELECT t1.domainid, t1.id, t1.name FROM dblink('hostaddr=210.77.68.240 port=5432 dbname=gene6ftp user=wlx password=gisgis'::text, 'select * from users'::text) t1(domainid integer, id integer, name character varying(64));
|
|
ALTER TABLE public.g6ftpusers OWNER TO gis;
|
|
|
|
CREATE VIEW g6ftpusersettings AS
|
|
SELECT t1.userid, t1.configname, t1.configvalue FROM dblink('hostaddr=210.77.68.240 port=5432 dbname=gene6ftp user=wlx password=gisgis'::text, 'select * from users_settings'::text) t1(userid integer, configname text, configvalue text);
|
|
ALTER TABLE public.g6ftpusersettings OWNER TO gis;
|
|
|
|
CREATE VIEW geonetworkmetadata AS
|
|
SELECT t1.id, t1.uuid, t1.schemaid, t1.data, t1.source FROM dblink('host=localhost dbname=wdscar_geonetwork user=gis password=gispassword'::text, 'select id,uuid,schemaid,data,source from metadata where istemplate=''n'''::text) t1(id integer, uuid uuid, schemaid text, data text, source text);
|
|
ALTER TABLE public.geonetworkmetadata OWNER TO gis;
|
|
|
|
CREATE VIEW geonetworkusers AS
|
|
SELECT t1.id, t1.username, t1.password, t1.email FROM dblink('dbname=geonetwork user=gis password=gispassword'::text, 'select id,username,password,email from geonetworkusers'::text) t1(id integer, username text, password text, email text);
|
|
ALTER TABLE public.geonetworkusers OWNER TO gis;
|
|
|
|
--
|
|
-- knowledge lib system
|
|
--
|
|
CREATE TABLE knl_article (
|
|
id integer NOT NULL,
|
|
title text DEFAULT ''::text NOT NULL,
|
|
authors character varying(100)[],
|
|
publisher character varying(500),
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
item_id integer DEFAULT 0 NOT NULL,
|
|
url character varying(100),
|
|
keywords text[],
|
|
ts_issued character varying(100)
|
|
);
|
|
ALTER TABLE public.knl_article OWNER TO gis;
|
|
CREATE SEQUENCE knl_article_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.knl_article_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE knl_article_id_seq OWNED BY knl_article.id;
|
|
|
|
CREATE TABLE knl_author (
|
|
id integer NOT NULL,
|
|
author text,
|
|
item_id integer,
|
|
place integer
|
|
);
|
|
ALTER TABLE public.knl_author OWNER TO gis;
|
|
CREATE SEQUENCE knl_author_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.knl_author_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE knl_author_id_seq OWNED BY knl_author.id;
|
|
|
|
CREATE VIEW knl_dcvalue AS
|
|
SELECT t1.dc_value_id, t1.item_id, t1.dc_type_id, t1.text_value, t1.text_lang, t1.place, t1.source_id FROM dblink('hostaddr=210.77.64.197 port=5432 dbname=seekspace user=seekspace password=seekspace90-='::text, 'select * from dcvalue'::text) t1(dc_value_id integer, item_id integer, dc_type_id integer, text_value text, text_lang character varying(24), place integer, source_id integer);
|
|
ALTER TABLE public.knl_dcvalue OWNER TO gis;
|
|
|
|
CREATE TABLE knl_keyword (
|
|
keyword text,
|
|
item_id integer,
|
|
place integer,
|
|
id integer NOT NULL
|
|
);
|
|
ALTER TABLE public.knl_keyword OWNER TO gis;
|
|
|
|
CREATE SEQUENCE knl_keyword_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.knl_keyword_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE knl_keyword_id_seq OWNED BY knl_keyword.id;
|
|
|
|
CREATE TABLE mdlimit (
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
lid integer NOT NULL
|
|
);
|
|
ALTER TABLE public.mdlimit OWNER TO gis;
|
|
CREATE SEQUENCE mdlimit_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.mdlimit_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE mdlimit_id_seq OWNED BY mdlimit.id;
|
|
|
|
CREATE TABLE mdref (
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
refid integer NOT NULL
|
|
);
|
|
ALTER TABLE public.mdref OWNER TO gis;
|
|
CREATE SEQUENCE mdref_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.mdref_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE mdref_id_seq OWNED BY mdref.id;
|
|
|
|
CREATE TABLE mdstat (
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
viewed integer DEFAULT 0 NOT NULL,
|
|
downloaded integer DEFAULT 0 NOT NULL
|
|
);
|
|
ALTER TABLE public.mdstat OWNER TO gis;
|
|
CREATE SEQUENCE mdstat_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.mdstat_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE mdstat_id_seq OWNED BY mdstat.id;
|
|
|
|
|
|
--
|
|
-- metadata review system
|
|
--
|
|
-- DROP TABLE mdreview;
|
|
CREATE TABLE mdreview
|
|
(
|
|
id serial NOT NULL,
|
|
userid integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
mdcomment text NOT NULL DEFAULT ''::text,
|
|
ts_created timestamp without time zone,
|
|
status integer NOT NULL DEFAULT 0,
|
|
is_expert boolean NOT NULL DEFAULT false,
|
|
ts_modified timestamp without time zone,
|
|
datacomment text,
|
|
editorcomment text,
|
|
conclusion integer NOT NULL DEFAULT 0,
|
|
CONSTRAINT mdreview_pkey PRIMARY KEY (id),
|
|
CONSTRAINT mdreview_userid_key UNIQUE (userid, uuid)
|
|
);
|
|
ALTER TABLE mdreview OWNER TO gis;
|
|
|
|
-- DROP TABLE mdstatus;
|
|
CREATE TABLE mdstatus
|
|
(
|
|
id serial NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
status integer NOT NULL DEFAULT 0,
|
|
ts_created timestamp without time zone NOT NULL DEFAULT now(),
|
|
ts_accepted timestamp without time zone,
|
|
ts_finished timestamp without time zone,
|
|
userid integer NOT NULL,
|
|
ts_scheduled timestamp without time zone,
|
|
CONSTRAINT mdstatus_pkey PRIMARY KEY (id),
|
|
CONSTRAINT mdstatus_uuid_key UNIQUE (uuid)
|
|
);
|
|
ALTER TABLE mdstatus OWNER TO gis;
|
|
|
|
-- DROP TABLE mdexperts;
|
|
CREATE TABLE mdexperts
|
|
(
|
|
id integer NOT NULL,
|
|
speciality text,
|
|
ts_created timestamp without time zone NOT NULL DEFAULT now(),
|
|
ts_modified timestamp without time zone,
|
|
CONSTRAINT mdexperts_pkey PRIMARY KEY (id)
|
|
);
|
|
ALTER TABLE mdexperts OWNER TO gis;
|
|
|
|
-- DROP TABLE mdexpertreview;
|
|
CREATE TABLE mdexpertreview
|
|
(
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
status integer NOT NULL DEFAULT 0,
|
|
ts_created timestamp without time zone NOT NULL DEFAULT now(),
|
|
ts_modified timestamp without time zone,
|
|
CONSTRAINT mdexpertreview_pkey PRIMARY KEY (id, uuid),
|
|
CONSTRAINT mdexpertreview_id_fkey FOREIGN KEY (id)
|
|
REFERENCES mdexperts (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION ON DELETE CASCADE,
|
|
CONSTRAINT mdexpertreview_uuid_fkey FOREIGN KEY (uuid)
|
|
REFERENCES mdstatus (uuid) MATCH SIMPLE
|
|
ON UPDATE NO ACTION ON DELETE CASCADE
|
|
);
|
|
ALTER TABLE mdexpertreview OWNER TO gis;
|
|
|
|
CREATE OR REPLACE VIEW normalmetadata AS
|
|
SELECT metadata.uuid, metadata.title, metadata.description, metadata.west, metadata.east, metadata.south, metadata.north, metadata.timebegin, metadata.timeend, metadata.id, metadata.filesize, metadata.datatype, metadata.citation, metadata.ts_created, metadata.fileformat, metadata.projection, metadata.author, metadata.title_en, metadata.suppinfo, metadata.source, metadata.doi
|
|
FROM metadata
|
|
WHERE NOT (metadata.uuid IN ( SELECT mdstatus.uuid
|
|
FROM mdstatus
|
|
WHERE mdstatus.status < 1));
|
|
|
|
ALTER TABLE normalmetadata OWNER TO gis;
|
|
|
|
CREATE TABLE offlineapp (
|
|
id integer NOT NULL,
|
|
userid integer,
|
|
username character varying(250),
|
|
unit character varying(500),
|
|
phone character varying(100),
|
|
address character varying(500),
|
|
postcode character varying(10),
|
|
project text,
|
|
pdflink character varying(200),
|
|
datalist text,
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
ts_approved timestamp without time zone,
|
|
email character varying(150),
|
|
status integer DEFAULT 0 NOT NULL
|
|
);
|
|
ALTER TABLE public.offlineapp OWNER TO gis;
|
|
CREATE SEQUENCE offlineapp_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.offlineapp_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE offlineapp_id_seq OWNED BY offlineapp.id;
|
|
|
|
CREATE TABLE onlineapp (
|
|
id integer NOT NULL,
|
|
userid integer,
|
|
username character varying(250),
|
|
unit character varying(500),
|
|
phone character varying(100),
|
|
address character varying(500),
|
|
postcode character varying(10),
|
|
project text,
|
|
uuid uuid,
|
|
ts_created timestamp without time zone DEFAULT now() NOT NULL,
|
|
email character varying(150)
|
|
);
|
|
ALTER TABLE public.onlineapp OWNER TO gis;
|
|
CREATE SEQUENCE onlineapp_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.onlineapp_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE onlineapp_id_seq OWNED BY onlineapp.id;
|
|
|
|
|
|
--
|
|
-- TOC entry 187 (class 1259 OID 25509)
|
|
-- Dependencies: 6 156
|
|
-- Name: order_id_seq; Type: SEQUENCE; Schema: public; Owner: gis
|
|
--
|
|
|
|
CREATE SEQUENCE order_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.order_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE order_id_seq OWNED BY dataorder.id;
|
|
|
|
CREATE VIEW proftpusers AS
|
|
SELECT t1.pkid, t1.userid, t1.passwd, t1.uid, t1.gid, t1.homedir FROM dblink('hostaddr=210.77.68.240 port=5432 dbname=ftp user=wlx password=gisgis'::text, 'select pkid,userid,passwd,uid,gid,homedir from ftp.users'::text) t1(pkid integer, userid character varying(64), passwd character varying(64), uid integer, gid integer, homedir character varying(64));
|
|
ALTER TABLE public.proftpusers OWNER TO gis;
|
|
|
|
CREATE TABLE reference (
|
|
id integer NOT NULL,
|
|
reference text NOT NULL,
|
|
link text
|
|
);
|
|
ALTER TABLE public.reference OWNER TO gis;
|
|
CREATE SEQUENCE reference_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.reference_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE reference_id_seq OWNED BY reference.id;
|
|
|
|
CREATE TABLE responsible (
|
|
id integer NOT NULL,
|
|
individual character varying(50),
|
|
organisation character varying(200),
|
|
"position" character varying(100),
|
|
delivery text,
|
|
email character varying(100),
|
|
postal character varying(20),
|
|
city character varying(100),
|
|
administrative character varying(100),
|
|
country character varying(100),
|
|
phone character varying(50)
|
|
);
|
|
ALTER TABLE public.responsible OWNER TO gis;
|
|
CREATE SEQUENCE responsible_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.responsible_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE responsible_id_seq OWNED BY responsible.id;
|
|
|
|
CREATE TABLE role (
|
|
id integer NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
resid integer NOT NULL,
|
|
role character varying(50) NOT NULL
|
|
);
|
|
ALTER TABLE public.role OWNER TO gis;
|
|
CREATE SEQUENCE role_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.role_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE role_id_seq OWNED BY role.id;
|
|
|
|
CREATE TABLE series (
|
|
id integer NOT NULL,
|
|
name character varying(100) NOT NULL,
|
|
description text
|
|
);
|
|
ALTER TABLE public.series OWNER TO gis;
|
|
CREATE SEQUENCE series_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.series_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE series_id_seq OWNED BY series.id;
|
|
|
|
CREATE TABLE source
|
|
(
|
|
id serial NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
code character varying(20) NOT NULL,
|
|
description text,
|
|
has_pages boolean NOT NULL DEFAULT false,
|
|
has_agreement boolean NOT NULL DEFAULT false,
|
|
title character varying(200),
|
|
CONSTRAINT source_pkey PRIMARY KEY (id),
|
|
CONSTRAINT source_name_key UNIQUE (code),
|
|
CONSTRAINT source_uuid_key UNIQUE (uuid)
|
|
);
|
|
ALTER TABLE source OWNER TO gis;
|
|
CREATE TABLE datasource
|
|
(
|
|
id serial NOT NULL,
|
|
uuid uuid NOT NULL,
|
|
sourceid integer NOT NULL DEFAULT 0,
|
|
CONSTRAINT datasource_pkey PRIMARY KEY (id),
|
|
CONSTRAINT datasource_sourceid_fkey FOREIGN KEY (sourceid)
|
|
REFERENCES source (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION ON DELETE CASCADE,
|
|
CONSTRAINT datasource_uuid_key UNIQUE (uuid, sourceid)
|
|
);
|
|
ALTER TABLE datasource OWNER TO gis;
|
|
|
|
--
|
|
-- TOC entry 141 (class 1259 OID 24828)
|
|
-- Dependencies: 6
|
|
-- Name: spatial_ref_sys; Type: TABLE; Schema: public; Owner: gis; Tablespace:
|
|
--
|
|
|
|
CREATE TABLE spatial_ref_sys (
|
|
srid integer NOT NULL,
|
|
auth_name character varying(256),
|
|
auth_srid integer,
|
|
srtext character varying(2048),
|
|
proj4text character varying(2048)
|
|
);
|
|
|
|
|
|
ALTER TABLE public.spatial_ref_sys OWNER TO gis;
|
|
|
|
--
|
|
-- TOC entry 197 (class 1259 OID 25544)
|
|
-- Dependencies: 6
|
|
-- Name: thumbnail; Type: TABLE; Schema: public; Owner: gis; Tablespace:
|
|
--
|
|
|
|
CREATE TABLE thumbnail (
|
|
id integer NOT NULL,
|
|
data text,
|
|
filetype character varying(100),
|
|
filename character varying(100),
|
|
filedesc character varying(200)
|
|
);
|
|
ALTER TABLE public.thumbnail OWNER TO gis;
|
|
|
|
CREATE TABLE uselimit (
|
|
id integer NOT NULL,
|
|
uselimit text NOT NULL
|
|
);
|
|
ALTER TABLE public.uselimit OWNER TO gis;
|
|
CREATE SEQUENCE uselimit_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MAXVALUE
|
|
NO MINVALUE
|
|
CACHE 1;
|
|
ALTER TABLE public.uselimit_id_seq OWNER TO gis;
|
|
ALTER SEQUENCE uselimit_id_seq OWNED BY uselimit.id;
|
|
|
|
CREATE VIEW watergn AS
|
|
SELECT t1.id, t1.uuid, t1.schemaid, t1.data, t1.source FROM dblink('host=210.77.68.252 dbname=new_geonetwork user=wlx password=gisgis'::text, 'select id,uuid,schemaid,data,source from metadata where istemplate=''n'''::text) t1(id integer, uuid uuid, schemaid text, data text, source text);
|
|
ALTER TABLE public.watergn OWNER TO gis;
|
|
|
|
CREATE TABLE xml (
|
|
id integer NOT NULL,
|
|
data pg_catalog.xml NOT NULL
|
|
);
|
|
ALTER TABLE public.xml OWNER TO gis;
|
|
|
|
ALTER TABLE comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);
|
|
ALTER TABLE datafeature ALTER COLUMN id SET DEFAULT nextval('datafeature_id_seq'::regclass);
|
|
ALTER TABLE datafile ALTER COLUMN id SET DEFAULT nextval('datafile_id_seq'::regclass);
|
|
ALTER TABLE dataorder ALTER COLUMN id SET DEFAULT nextval('order_id_seq'::regclass);
|
|
ALTER TABLE dataset ALTER COLUMN id SET DEFAULT nextval('dataset_id_seq'::regclass);
|
|
ALTER TABLE datasetcd ALTER COLUMN id SET DEFAULT nextval('datasetcd_id_seq'::regclass);
|
|
ALTER TABLE emailtext ALTER COLUMN id SET DEFAULT nextval('emailtext_id_seq'::regclass);
|
|
ALTER TABLE knl_article ALTER COLUMN id SET DEFAULT nextval('knl_article_id_seq'::regclass);
|
|
ALTER TABLE knl_author ALTER COLUMN id SET DEFAULT nextval('knl_author_id_seq'::regclass);
|
|
ALTER TABLE knl_keyword ALTER COLUMN id SET DEFAULT nextval('knl_keyword_id_seq'::regclass);
|
|
ALTER TABLE mdlimit ALTER COLUMN id SET DEFAULT nextval('mdlimit_id_seq'::regclass);
|
|
ALTER TABLE mdref ALTER COLUMN id SET DEFAULT nextval('mdref_id_seq'::regclass);
|
|
ALTER TABLE mdstat ALTER COLUMN id SET DEFAULT nextval('mdstat_id_seq'::regclass);
|
|
ALTER TABLE mdstatus ALTER COLUMN id SET DEFAULT nextval('mdstatus_id_seq'::regclass);
|
|
ALTER TABLE metadata ALTER COLUMN id SET DEFAULT nextval('metadata_id_seq'::regclass);
|
|
ALTER TABLE offlineapp ALTER COLUMN id SET DEFAULT nextval('offlineapp_id_seq'::regclass);
|
|
ALTER TABLE onlineapp ALTER COLUMN id SET DEFAULT nextval('onlineapp_id_seq'::regclass);
|
|
ALTER TABLE onlineresource ALTER COLUMN id SET DEFAULT nextval('onlinesource_id_seq'::regclass);
|
|
ALTER TABLE reference ALTER COLUMN id SET DEFAULT nextval('reference_id_seq'::regclass);
|
|
ALTER TABLE responsible ALTER COLUMN id SET DEFAULT nextval('responsible_id_seq'::regclass);
|
|
ALTER TABLE role ALTER COLUMN id SET DEFAULT nextval('role_id_seq'::regclass);
|
|
ALTER TABLE series ALTER COLUMN id SET DEFAULT nextval('series_id_seq'::regclass);
|
|
ALTER TABLE uselimit ALTER COLUMN id SET DEFAULT nextval('uselimit_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY category
|
|
ADD CONSTRAINT category_code_key UNIQUE (code, id);
|
|
ALTER TABLE ONLY category
|
|
ADD CONSTRAINT category_pkey PRIMARY KEY (id, code);
|
|
ALTER TABLE ONLY categorycode
|
|
ADD CONSTRAINT categorycode_pkey PRIMARY KEY (code);
|
|
ALTER TABLE ONLY comments
|
|
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY comments
|
|
ADD CONSTRAINT comments_userid_key UNIQUE (userid, uuid, content);
|
|
ALTER TABLE ONLY datafeature
|
|
ADD CONSTRAINT datafeature_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY datafeature
|
|
ADD CONSTRAINT datafeature_title_key UNIQUE (title);
|
|
ALTER TABLE ONLY datafile
|
|
ADD CONSTRAINT datafile_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY dataseries
|
|
ADD CONSTRAINT dataseries_id_key UNIQUE (id, sid);
|
|
ALTER TABLE ONLY dataseries
|
|
ADD CONSTRAINT dataseries_pkey PRIMARY KEY (id, sid);
|
|
ALTER TABLE ONLY dataset
|
|
ADD CONSTRAINT dataset_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY dataset
|
|
ADD CONSTRAINT dataset_uuid_key UNIQUE (uuid);
|
|
ALTER TABLE ONLY datasetcd
|
|
ADD CONSTRAINT datasetcd_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY datasetcd
|
|
ADD CONSTRAINT datasetcd_title_key UNIQUE (title);
|
|
ALTER TABLE ONLY emailtext
|
|
ADD CONSTRAINT emailtext_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY emailtext
|
|
ADD CONSTRAINT emailtext_template_key UNIQUE (template);
|
|
ALTER TABLE ONLY ftpuser
|
|
ADD CONSTRAINT ftpuser_pkey PRIMARY KEY (userid);
|
|
--ALTER TABLE ONLY geometry_columns
|
|
-- ADD CONSTRAINT geometry_columns_pk PRIMARY KEY (f_table_catalog, f_table_schema, f_table_name, f_geometry_column);
|
|
ALTER TABLE ONLY keyword
|
|
ADD CONSTRAINT keyword_id_key UNIQUE (id, keyword);
|
|
ALTER TABLE ONLY keyword
|
|
ADD CONSTRAINT keyword_pkey PRIMARY KEY (id, keyword);
|
|
ALTER TABLE ONLY knl_article
|
|
ADD CONSTRAINT knl_article_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY knl_author
|
|
ADD CONSTRAINT knl_author_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY knl_keyword
|
|
ADD CONSTRAINT knl_keyword_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY mdexperts
|
|
ADD CONSTRAINT mdexperts_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY mdlimit
|
|
ADD CONSTRAINT mdlimit_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY mdlimit
|
|
ADD CONSTRAINT mdlimit_uuid_key UNIQUE (uuid, lid);
|
|
ALTER TABLE ONLY mdref
|
|
ADD CONSTRAINT mdref_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY mdref
|
|
ADD CONSTRAINT mdref_uuid_key UNIQUE (uuid, refid);
|
|
ALTER TABLE ONLY mdstat
|
|
ADD CONSTRAINT mdstat_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY mdstat
|
|
ADD CONSTRAINT mdstat_uuid_key UNIQUE (uuid);
|
|
ALTER TABLE ONLY mdstatus
|
|
ADD CONSTRAINT mdstatus_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY mdstatus
|
|
ADD CONSTRAINT mdstatus_uuid_key UNIQUE (uuid);
|
|
ALTER TABLE ONLY offlineapp
|
|
ADD CONSTRAINT offlineapp_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY onlineapp
|
|
ADD CONSTRAINT onlineapp_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY onlineresource
|
|
ADD CONSTRAINT onlinesource_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY dataorder
|
|
ADD CONSTRAINT order_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY reference
|
|
ADD CONSTRAINT reference_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY reference
|
|
ADD CONSTRAINT reference_reference_key UNIQUE (reference);
|
|
ALTER TABLE ONLY responsible
|
|
ADD CONSTRAINT responsible_individual_key UNIQUE (individual, organisation);
|
|
ALTER TABLE ONLY responsible
|
|
ADD CONSTRAINT responsible_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY role
|
|
ADD CONSTRAINT role_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY role
|
|
ADD CONSTRAINT role_uuid_key UNIQUE (uuid, resid, role);
|
|
ALTER TABLE ONLY series
|
|
ADD CONSTRAINT series_name_key UNIQUE (name);
|
|
ALTER TABLE ONLY series
|
|
ADD CONSTRAINT series_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY spatial_ref_sys
|
|
ADD CONSTRAINT spatial_ref_sys_pkey PRIMARY KEY (srid);
|
|
ALTER TABLE ONLY thumbnail
|
|
ADD CONSTRAINT thumbnail_id_key UNIQUE (id);
|
|
ALTER TABLE ONLY thumbnail
|
|
ADD CONSTRAINT thumbnail_pkey PRIMARY KEY (id);
|
|
ALTER TABLE ONLY uselimit
|
|
ADD CONSTRAINT uselimit_limit_key UNIQUE (uselimit);
|
|
ALTER TABLE ONLY uselimit
|
|
ADD CONSTRAINT uselimit_pkey PRIMARY KEY (id);
|
|
|
|
ALTER TABLE ONLY xml
|
|
ADD CONSTRAINT xml_id_key UNIQUE (id);
|
|
ALTER TABLE ONLY xml
|
|
ADD CONSTRAINT xml_pkey PRIMARY KEY (id);
|
|
|
|
CREATE RULE insert_ftpusersettings AS ON INSERT TO g6ftpusersettings DO INSTEAD SELECT dblink_exec('hostaddr=210.77.68.240 dbname=gene6ftp user=wlx password=gisgis'::text, dblink_current_query()) AS dblink_exec;
|
|
CREATE RULE insert_g6ftpusers AS ON INSERT TO g6ftpusers DO INSTEAD SELECT dblink_exec('hostaddr=210.77.68.240 dbname=gene6ftp user=wlx password=gisgis'::text, dblink_current_query()) AS dblink_exec;
|
|
CREATE RULE insert_gnusers AS ON INSERT TO geonetworkusers DO INSTEAD SELECT dblink_exec('dbname=geonetwork user=gis password=gispassword'::text, dblink_current_query()) AS dblink_exec;
|
|
CREATE RULE insert_offlineapp_users AS ON INSERT TO offlineapp WHERE (new.userid > 0) DO UPDATE users SET realname = new.username, unit = new.unit, address = new.address, project = new.project, phone = new.phone, email = new.email WHERE (users.id = new.userid);
|
|
CREATE RULE insert_onlineapp_users AS ON INSERT TO onlineapp WHERE (new.userid > 0) DO UPDATE users SET realname = new.username, unit = new.unit, address = new.address, project = new.project, phone = new.phone, email = new.email WHERE (users.id = new.userid);
|
|
CREATE RULE insert_proftpusers AS ON INSERT TO proftpusers DO INSTEAD SELECT dblink_exec('hostaddr=210.77.68.240 dbname=ftp user=wlx password=gisgis'::text, dblink_current_query()) AS dblink_exec;
|
|
|
|
CREATE RULE update_ftpusersettings AS ON UPDATE TO g6ftpusersettings DO INSTEAD SELECT dblink_exec('hostaddr=210.77.68.240 dbname=gene6ftp user=wlx password=gisgis'::text, dblink_current_query()) AS dblink_exec;
|
|
CREATE RULE update_gnusers AS ON UPDATE TO geonetworkusers DO INSTEAD SELECT dblink_exec('dbname=geonetwork user=gis password=gispassword'::text, dblink_current_query()) AS dblink_exec;
|
|
CREATE RULE update_offlineapp_users AS ON UPDATE TO offlineapp WHERE (old.userid > 0) DO UPDATE users SET realname = new.username, unit = new.unit, address = new.address, project = new.project, phone = new.phone, email = new.email WHERE (users.id = old.userid);
|
|
CREATE RULE update_onlineapp_users AS ON UPDATE TO onlineapp WHERE (old.userid > 0) DO UPDATE users SET realname = new.username, unit = new.unit, address = new.address, project = new.project, phone = new.phone, email = new.email WHERE (users.id = old.userid);
|
|
CREATE RULE update_proftpusers AS ON UPDATE TO proftpusers DO INSTEAD SELECT dblink_exec('hostaddr=210.77.68.240 dbname=ftp user=wlx password=gisgis'::text, dblink_current_query()) AS dblink_exec;
|
|
CREATE RULE update_watergn AS ON UPDATE TO watergn DO INSTEAD SELECT dblink_exec('hostaddr=210.77.68.252 dbname=new_geonetwork user=wlx password=gisgis'::text, dblink_current_query()) AS dblink_exec;
|
|
|
|
ALTER TABLE ONLY category
|
|
ADD CONSTRAINT category_code_fkey FOREIGN KEY (code) REFERENCES categorycode(code);
|
|
ALTER TABLE ONLY category
|
|
ADD CONSTRAINT category_id_fkey FOREIGN KEY (id) REFERENCES metadata(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY datafile
|
|
ADD CONSTRAINT datafile_dsid_fkey FOREIGN KEY (dsid) REFERENCES dataset(id) ON DELETE CASCADE;
|
|
--ALTER TABLE ONLY dataorder
|
|
-- ADD CONSTRAINT dataorder_userid_fkey FOREIGN KEY (userid) REFERENCES users(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY dataseries
|
|
ADD CONSTRAINT dataseries_id_fkey FOREIGN KEY (id) REFERENCES metadata(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY dataseries
|
|
ADD CONSTRAINT dataseries_sid_fkey FOREIGN KEY (sid) REFERENCES series(id) ON DELETE CASCADE;
|
|
--ALTER TABLE ONLY ftpuser
|
|
-- ADD CONSTRAINT ftpuser_userid_fkey FOREIGN KEY (userid) REFERENCES users(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY keyword
|
|
ADD CONSTRAINT keyword_id_fkey FOREIGN KEY (id) REFERENCES metadata(id) ON DELETE CASCADE;
|
|
--ALTER TABLE ONLY mdexperts
|
|
-- ADD CONSTRAINT mdexperts_id_fkey FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY mdlimit
|
|
ADD CONSTRAINT mdlimit_uuid_fkey FOREIGN KEY (uuid) REFERENCES metadata(uuid) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY mdref
|
|
ADD CONSTRAINT mdref_refid_fkey FOREIGN KEY (refid) REFERENCES reference(id) ON DELETE CASCADE;
|
|
--ALTER TABLE ONLY mdstatus
|
|
-- ADD CONSTRAINT mdstatus_userid_fkey FOREIGN KEY (userid) REFERENCES users(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY onlineresource
|
|
ADD CONSTRAINT onlinesource_uuid_fkey FOREIGN KEY (uuid) REFERENCES metadata(uuid) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY role
|
|
ADD CONSTRAINT role_resid_fkey FOREIGN KEY (resid) REFERENCES responsible(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY role
|
|
ADD CONSTRAINT role_uuid_fkey FOREIGN KEY (uuid) REFERENCES metadata(uuid) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY thumbnail
|
|
ADD CONSTRAINT thumbnail_id_fkey FOREIGN KEY (id) REFERENCES metadata(id) ON DELETE CASCADE;
|
|
ALTER TABLE ONLY xml
|
|
ADD CONSTRAINT xml_id_fkey FOREIGN KEY (id) REFERENCES metadata(id) ON DELETE CASCADE;
|
|
|
|
REVOKE ALL ON SCHEMA public FROM PUBLIC;
|
|
REVOKE ALL ON SCHEMA public FROM postgres;
|
|
GRANT ALL ON SCHEMA public TO postgres;
|
|
GRANT ALL ON SCHEMA public TO PUBLIC;
|
|
|
|
REVOKE ALL ON TABLE geonetworkusers FROM PUBLIC;
|
|
REVOKE ALL ON TABLE geonetworkusers FROM gis;
|
|
GRANT ALL ON TABLE geonetworkusers TO gis;
|
|
GRANT ALL ON TABLE geonetworkusers TO PUBLIC;
|
|
|
|
REVOKE ALL ON TABLE spatial_ref_sys FROM PUBLIC;
|
|
REVOKE ALL ON TABLE spatial_ref_sys FROM gis;
|
|
GRANT ALL ON TABLE spatial_ref_sys TO gis;
|
|
GRANT ALL ON TABLE spatial_ref_sys TO postgres;
|
|
GRANT ALL ON TABLE spatial_ref_sys TO PUBLIC;
|
|
|
|
-- Completed on 2011-10-23 11:37:59 CST
|