New tg ID schema and initial importer #35

Merged
amigan merged 17 commits from reid into trunk 2024-11-15 13:28:05 -05:00
3 changed files with 32 additions and 0 deletions
Showing only changes of commit 45eb4c9f3e - Show all commits

24
.bin/dumpdb.sh Normal file
View 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
View file

@ -10,3 +10,4 @@ Session.vim
*.log *.log
*.dlv *.dlv
cover.out cover.out
backups/

View file

@ -35,5 +35,12 @@ coverage-html:
coverage: coverage:
go test -coverprofile cover.out go test -coverprofile cover.out
# backup backs up the database without calls
backup:
sh .bin/dumpdb.sh
backupplain:
sh .bin/dumpdb.sh -p
test: test:
go test -v ./... go test -v ./...