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:
parent
488b88c3cf
commit
d2d48920f4
2 changed files with 6 additions and 3 deletions
3
sql/update-2016-10-06.sql
Normal file
3
sql/update-2016-10-06.sql
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue