light backup
This commit is contained in:
parent
d0930d76e3
commit
6706548c20
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Лайт-бэкап medicine для cloud:
|
||||||
|
# medicine-for-cloud-base.tar.gz — основа без тяжёлых данных
|
||||||
|
#
|
||||||
|
# Исключены данные:
|
||||||
|
# booking_*, registry_*,
|
||||||
|
# record_group, record_hospitaltransferdepartment, record_preferentialcategory,
|
||||||
|
# record_record, record_recordservice, record_signeddocument
|
||||||
|
# (+ прочие тяжёлые/технические таблицы)
|
||||||
|
#
|
||||||
|
# record_case* остаются в основном дампе.
|
||||||
|
#
|
||||||
|
# Restore:
|
||||||
|
# tar -xzf medicine-for-cloud-base.tar.gz
|
||||||
|
# psql -U postgres -d medicine -f medicine-for-cloud-base.sql
|
||||||
|
|
||||||
|
set -e
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
|
CONTAINER="${POSTGRES_CONTAINER:-medicine-stack-postgres}"
|
||||||
|
DB_USER="${POSTGRES_USER:-postgres}"
|
||||||
|
DB_NAME="${POSTGRES_DB:-medicine}"
|
||||||
|
BACKUP_DIR="${BACKUP_DIR:-${HOME}/medicine-backups}"
|
||||||
|
|
||||||
|
mkdir -p "${BACKUP_DIR}"
|
||||||
|
cd "${BACKUP_DIR}"
|
||||||
|
|
||||||
|
base_sql="medicine-for-cloud-base.sql"
|
||||||
|
base_archive="medicine-for-cloud-base.tar.gz"
|
||||||
|
|
||||||
|
echo "==> base dump: ${base_sql}"
|
||||||
|
docker exec -i "${CONTAINER}" pg_dump --no-owner -U "${DB_USER}" -F p "${DB_NAME}" \
|
||||||
|
--exclude-table-data=riisz_logging \
|
||||||
|
--exclude-table-data=patient_changes \
|
||||||
|
--exclude-table-data=все_талоны_подробно \
|
||||||
|
--exclude-table-data=талоны_подробно \
|
||||||
|
--exclude-table-data=все_талоны \
|
||||||
|
--exclude-table-data=пациенты \
|
||||||
|
--exclude-table-data='historical_*' \
|
||||||
|
--exclude-table-data='local_*' \
|
||||||
|
--exclude-table-data='reversion_*' \
|
||||||
|
--exclude-table-data='booking_*' \
|
||||||
|
--exclude-table-data='registry_*' \
|
||||||
|
--exclude-table-data=record_group \
|
||||||
|
--exclude-table-data=record_hospitaltransferdepartment \
|
||||||
|
--exclude-table-data=record_preferentialcategory \
|
||||||
|
--exclude-table-data=record_record \
|
||||||
|
--exclude-table-data=record_recordservice \
|
||||||
|
--exclude-table-data=record_signeddocument \
|
||||||
|
> "${base_sql}"
|
||||||
|
|
||||||
|
echo "==> archive: ${base_archive}"
|
||||||
|
rm -f "${base_archive}"
|
||||||
|
tar -czf "${base_archive}" "${base_sql}"
|
||||||
|
rm -f "${base_sql}"
|
||||||
|
|
||||||
|
echo "Done: ${BACKUP_DIR}/${base_archive}"
|
||||||
Loading…
Reference in New Issue