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

12 lines
619 B
Text
Executable file

pg_dump -O -U phpcompta -s mod2 | 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 -O -U phpcompta -D -a -O mod2 > data.sql