New tg ID schema and initial importer #35
3 changed files with 32 additions and 0 deletions
24
.bin/dumpdb.sh
Normal file
24
.bin/dumpdb.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
config=config.yaml
|
||||
pgformat="-Fc"
|
||||
ext=pgdump
|
||||
|
||||
while getopts ":p" arg; do
|
||||
case $arg in
|
||||
c)
|
||||
config=$OPTARG
|
||||
;;
|
||||
p)
|
||||
pgformat="-Fp"
|
||||
ext=sql
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
filen=`date "+backups/%Y%m%d_%H%M%S.${ext}"`
|
||||
|
||||
mkdir -p backups/
|
||||
dbstring=`yq -r .db.connect "${config}"`
|
||||
pg_dump "${pgformat}" -f "${filen}" -T calls "${dbstring}"
|
||||
echo "backed up to ${filen}"
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ Session.vim
|
|||
*.log
|
||||
*.dlv
|
||||
cover.out
|
||||
backups/
|
||||
|
|
7
Makefile
7
Makefile
|
@ -35,5 +35,12 @@ coverage-html:
|
|||
coverage:
|
||||
go test -coverprofile cover.out
|
||||
|
||||
# backup backs up the database without calls
|
||||
backup:
|
||||
sh .bin/dumpdb.sh
|
||||
|
||||
backupplain:
|
||||
sh .bin/dumpdb.sh -p
|
||||
|
||||
test:
|
||||
go test -v ./...
|
||||
|
|
Loading…
Reference in a new issue