altocompta/include/sql/account_repository/make-sql

18 lines
581 B
Bash
Executable file

#!/bin/bash
# Create script for exporting a new template
# DDB 2018-01-28
# under GPL license
#
#export TEMPLATE=${DOMAIN}account_repository
export TEMPLATE=account_repository
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
echo "set search_path = public,comptaproc,pg_catalog ;" > data.sql
pg_dump -O -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql