1 |
9624
|
aaronmk
|
#!/bin/bash -e
|
2 |
|
|
. "$(dirname "${BASH_SOURCE[0]}")"/db.sh
|
3 |
9854
|
aaronmk
|
.rel make.sh
|
4 |
10396
|
aaronmk
|
|
5 |
|
|
if self_not_included; then
|
6 |
|
|
|
7 |
|
|
pg_export_table_to_dir()
|
8 |
|
|
{
|
9 |
|
|
echo_func; set_make_vars; check_fake_target_exists
|
10 |
|
|
local table="$1"; shift; mk_table_esc
|
11 |
|
|
stdout="$exports_dir/$table.csv" to_file pg_export "$@"
|
12 |
|
|
}
|
13 |
|
|
|
14 |
|
|
pg_export_tables_to_dir()
|
15 |
|
|
# usage: exports_dir=... schema=... pg_export_tables_to_dir table...
|
16 |
|
|
{
|
17 |
|
|
echo_func; kw_params exports_dir schema; : "${exports_dir:?}" "${schema:?}"
|
18 |
|
|
for table in "$@"; do pg_export_table_to_dir "$table"; done
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
fi
|