altocompta/html/admin/sql/account_repository/make-sql
2006-07-04 22:19:44 +00:00

12 lines
644 B
Text
Executable file

pg_dump -O -U phpcompta -s account_repository | awk '!/--/ {if ( ! /^$/) print $0;}' > schema.sql
awk '/SEQUENCE/,/;/ { print $0;}' < schema.sql > sequence.sql
awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql > table.sql
awk '/CREATE VIEW/,/;/ { print $0;}' < schema.sql > view.sql
awk '/INDEX/,/;/ { print $0;}' < schema.sql > index.sql
awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql > constraint.sql
awk '/CREATE FUNCTION/,/LANGUAGE/ { print $0;}' < schema.sql > function.sql
awk '/COMMENT/,/;/ {print $0;}' < schema.sql > comment.sql
grep setval schema.sql >> sequence.sql
pg_dump -U phpcompta -D -a -O account_repository > data.sql