SQL: Add ON DELETE clause to foreign keys

This makes it easier to remove a complete package or system when
debugging.
This commit is contained in:
Yorhel 2016-10-06 09:52:18 +02:00
parent 488b88c3cf
commit d2d48920f4
2 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1,3 @@
ALTER TABLE packages DROP CONSTRAINT packages_system_fkey, ADD CONSTRAINT packages_system_fkey FOREIGN KEY(system) REFERENCES systems(id) ON DELETE CASCADE;
ALTER TABLE package_versions DROP CONSTRAINT package_versions_package_fkey, ADD CONSTRAINT package_versions_package_fkey FOREIGN KEY(package) REFERENCES packages(id) ON DELETE CASCADE;
ALTER TABLE man DROP CONSTRAINT man_package_fkey, ADD CONSTRAINT man_package_fkey FOREIGN KEY(package) REFERENCES package_versions(id) ON DELETE CASCADE;