1 |
12212
|
aaronmk
|
#!/bin/bash -e
|
2 |
|
|
# syncs validations queries with the DB
|
3 |
|
|
. "$(dirname "${BASH_SOURCE[0]}")"/file.pg.sql.run
|
4 |
13373
|
aaronmk
|
.rel subdir.run
|
5 |
12212
|
aaronmk
|
|
6 |
|
|
if self_not_included; then
|
7 |
|
|
|
8 |
|
|
func_override export___schema.pg.sql.run
|
9 |
13367
|
aaronmk
|
export_() # usage: rm=1 .../file.run export_ # resulting export is idempotent
|
10 |
12214
|
aaronmk
|
{
|
11 |
|
|
echo_func
|
12 |
|
|
#need explicit schema so matching tables from other schemas are not included
|
13 |
12224
|
aaronmk
|
export___schema.pg.sql.run --table="\"$schema\"._[[:alpha:]]+_\d*" "$@"
|
14 |
13367
|
aaronmk
|
# make export idempotent
|
15 |
|
|
in_place "$top_file" sed 's/CREATE VIEW/CREATE OR REPLACE VIEW/g'
|
16 |
12214
|
aaronmk
|
}
|
17 |
12212
|
aaronmk
|
|
18 |
|
|
fi
|