From d6ef24811f182a6ee62dbb4cf27f278e778b1f36 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Tue, 26 Mar 2019 14:40:57 +0100 Subject: [PATCH] [#8400] Fixed PostgreSQL Sakila deletion script --- .../postgres-sakila-db/postgres-sakila-delete-data.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-delete-data.sql b/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-delete-data.sql index 84c0050b5f..318f9a0579 100644 --- a/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-delete-data.sql +++ b/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-delete-data.sql @@ -1,6 +1,8 @@ -- Delete data +ALTER TABLE store DROP CONSTRAINT store_manager_staff_id_fkey; ALTER TABLE staff DROP CONSTRAINT staff_address_id_fkey; ALTER TABLE staff DROP CONSTRAINT staff_store_id_fkey; + DELETE FROM payment ; DELETE FROM rental ; DELETE FROM customer ; @@ -18,4 +20,5 @@ DELETE FROM country ; DELETE FROM language ; ALTER TABLE staff ADD CONSTRAINT staff_address_id_fkey FOREIGN KEY (address_id) REFERENCES address (address_id) ON UPDATE CASCADE; -ALTER TABLE staff ADD CONSTRAINT staff_store_id_fkey FOREIGN KEY (store_id) REFERENCES store (store_id) ON UPDATE CASCADE; \ No newline at end of file +ALTER TABLE staff ADD CONSTRAINT staff_store_id_fkey FOREIGN KEY (store_id) REFERENCES store (store_id) ON UPDATE CASCADE; +ALTER TABLE store ADD CONSTRAINT store_manager_staff_id_fkey FOREIGN KEY (manager_staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT;