altocompta/include/sql/mod2/make-sql

19 lines
605 B
Bash
Executable file

#!/bin/bash
# Create script for exporting a new template
# DDB 2018-01-28
# under GPL license
#
export TEMPLATE=${DOMAIN}mod2
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
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
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql
sed -ne '/ADD CONSTRAINT/,$p' schema.sql |sed -e '1d' > constraint.sql
cp tmpSchema.sql schema.sql