Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Vinay Pai for Protecting specific object id from being deleted in MySQL

You can do this by creating another table which references this table with a FOREIGN KEY constraint, and ON DELETE RESTRICT.

CREATE TABLE protected_objects (    obj_id INT    FOREIGN KEY(obj_id)        REFERENCES objects(id)        ON DELETE RESTRICT)

You can create rows in the protected_objects table that lists the objects that should be protected. You can control the ability to protect and un-protect objects by restricting privileges on the protected_objects table as appropriate for your use case.


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>