From b92fbe41446ae7b461630bab9af772a7ee0cfd5a Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 28 Jan 2018 10:56:18 +0100 Subject: [PATCH] Add licence + template name --- include/sql/mod1/make-sql | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/sql/mod1/make-sql b/include/sql/mod1/make-sql index d140cff17..6e9175aa7 100755 --- a/include/sql/mod1/make-sql +++ b/include/sql/mod1/make-sql @@ -1,4 +1,12 @@ -pg_dump -O -U dany -s ${DOMAIN}mod1|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql +#!/bin/bash +# Create script for exporting a new template +# DDB 2018-01-28 +# under GPL license +# + +export TEMPLATE=${DOMAIN}mod1 + +pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql awk '/SEQUENCE/,/;/ { print $0;}' < schema.sql > sequence.sql awk '/CREATE DOMAIN/,/;/ { print $0;}' < schema.sql > table.sql awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql >> table.sql @@ -27,6 +35,6 @@ sed -i -e "/ALTER TABLE.*/d" -e "/ADD CONSTRAINT/d" -e "/CREATE PROCEDURAL/d" -e grep setval schema.sql >> sequence.sql echo "set search_path = public, comptaproc,pg_catalog ;" > data.sql -pg_dump -O -U dany --data-only --column-inserts -O ${DOMAIN}mod1 |sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql +pg_dump -O -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql