From: Frank Brehm Date: Fri, 3 Nov 2017 11:26:35 +0000 (+0100) Subject: Starting with schema pdns_public X-Git-Tag: 0.1.2~124^2~2 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=fd371bd67c4e860230d735c17407c26cbc38dc2e;p=pixelpark%2Fadmin-tools.git Starting with schema pdns_public --- diff --git a/dns/schema.pgsql.sql b/dns/schema.pgsql.sql index de34367..8c49d9d 100644 --- a/dns/schema.pgsql.sql +++ b/dns/schema.pgsql.sql @@ -221,12 +221,22 @@ BEGIN WORK; CREATE EXTENSION IF NOT EXISTS postgres_fdw; -CREATE SERVER pdns_master FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'systemshare.pixelpark.com', dbname 'pdns'); +CREATE SERVER pdns_master + FOREIGN DATA WRAPPER postgres_fdw + OPTIONS (host 'systemshare.pixelpark.com', dbname 'pdns'); ALTER SERVER pdns_master OWNER TO pdns_local; -CREATE USER MAPPING FOR pdns_local SERVER pdns_master OPTIONS (user 'pdns_local', password 'Neingeichee(ghahn7ah'); +CREATE USER MAPPING FOR pdns_local + SERVER pdns_master + OPTIONS (user 'pdns_local', password 'Neingeichee(ghahn7ah'); CREATE SCHEMA IF NOT EXISTS pdns; ALTER SCHEMA pdns OWNER TO pdns_local; + +COMMIT; + +BEGIN WORK; + +-- Execute as User pdns_local !!! IMPORT FOREIGN SCHEMA public FROM SERVER pdns_master INTO pdns; COMMIT; @@ -319,5 +329,47 @@ ALTER TABLE IF EXISTS public.tsigkeys OWNER TO pdns_local; COMMIT; +-- ---------------------------------------------------------------------- + +\connect pdns_public + +BEGIN WORK; + +CREATE EXTENSION IF NOT EXISTS postgres_fdw; + +CREATE SERVER pdns_master + FOREIGN DATA WRAPPER postgres_fdw + OPTIONS (host 'systemshare.pixelpark.com', dbname 'pdns'); +ALTER SERVER pdns_master OWNER TO pdns_public; +CREATE USER MAPPING FOR pdns_public + SERVER pdns_master + OPTIONS (user 'pdns_public', password 'ahr7die3gee]s4vahCoh'); + +CREATE SCHEMA IF NOT EXISTS pdns; +ALTER SCHEMA pdns OWNER TO pdns_public; + +COMMIT; + +BEGIN WORK; + +-- Execute as User pdns_public !!! +IMPORT FOREIGN SCHEMA public FROM SERVER pdns_master INTO pdns; + +COMMIT; + +-- ---------------- + +BEGIN WORK; + +CREATE or REPLACE VIEW public.domains AS +SELECT id, name, master, last_check, type, notified_serial, account + FROM pdns.domains + WHERE account IS NULL OR account !~* '.*(lo[ck]al|privat|intern).*' + ORDER BY name; + +ALTER TABLE IF EXISTS public.domains OWNER TO pdns_local; + +COMMIT; + -- vim: list