FAQ | This is a LIVE service | Changelog

Commit c206b71f authored by Dr Adam Thorn's avatar Dr Adam Thorn
Browse files

Ensure foreign keys will ON DELETE CASCADE when deleting a host

i.e. we can now simply

delete from host where hostname='example.ch.private.cam.ac.uk';

without having to chase the foreign keys.

I've made the equivalent change on our live backup servers with
an ad hoc script.
parent 520764f0
......@@ -3,6 +3,6 @@ Priority: optional
Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all
Version: 0.9-ch91
Version: 0.9-ch92
Depends: zfs-dkms, postgresql-13 | postgresql-9.5 | postgresql-9.4 , liblockfile-simple-perl, libdbi-perl, libjson-perl, libzfs-perl-chem, libnet-openssh-perl, libdbd-pg-perl, mbuffer, rsync, nfs-kernel-server, pv, libwww-curl-perl
Description: a backup system using ZFS (repository 'backup-scheduler')
......@@ -1477,7 +1477,7 @@ SET search_path = public, pg_catalog;
--
ALTER TABLE ONLY backup_log
ADD CONSTRAINT backup_log_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id);
ADD CONSTRAINT backup_log_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id) ON DELETE CASCADE;
--
......@@ -1493,7 +1493,7 @@ ALTER TABLE ONLY backup_task
--
ALTER TABLE ONLY backup_task
ADD CONSTRAINT backup_task_host_id_fkey FOREIGN KEY (host_id) REFERENCES host(host_id);
ADD CONSTRAINT backup_task_host_id_fkey FOREIGN KEY (host_id) REFERENCES host(host_id) ON DELETE CASCADE;
--
......@@ -1501,7 +1501,7 @@ ALTER TABLE ONLY backup_task
--
ALTER TABLE ONLY zfs_detail
ADD CONSTRAINT zfs_detail_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id);
ADD CONSTRAINT zfs_detail_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id) ON DELETE CASCADE;
--
......@@ -1509,7 +1509,7 @@ ALTER TABLE ONLY zfs_detail
--
ALTER TABLE ONLY zfs_pruning
ADD CONSTRAINT zfs_pruning_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id);
ADD CONSTRAINT zfs_pruning_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id) ON DELETE CASCADE;
--
......@@ -1517,7 +1517,7 @@ ALTER TABLE ONLY zfs_pruning
--
ALTER TABLE ONLY zfs_rsync_detail
ADD CONSTRAINT zfs_rsync_detail_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id);
ADD CONSTRAINT zfs_rsync_detail_backup_task_id_fkey FOREIGN KEY (backup_task_id) REFERENCES backup_task(backup_task_id) ON DELETE CASCADE;
--
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment