Yeo Bryan
Yeo Bryan

Reputation: 431

mySQL Foreign Key Constraint Not Being Saved When Updated Through Workbench

Whenever I update the foreign key constraint setting through mySQL workbench, the updated setting isn't saved permanently.

Despite setting the foreign key option to null and successfully saving the changes, upon reopening the alter table tab it will revert back to showing restrict. What am I doing wrongly? enter image description here

Upvotes: 0

Views: 176

Answers (1)

Yeo Bryan
Yeo Bryan

Reputation: 431

The updated settings to the foreign key constraints have actually already been applied just that it isn't showing on the mySQL workbench UI.

By checking the update_rule and delete_rule on mySQL, the constraints have indeed be updated to be of null action. enter image description here

   SELECT CONSTRAINT_NAME,
           UNIQUE_CONSTRAINT_NAME, 
           MATCH_OPTION, 
           UPDATE_RULE,
           DELETE_RULE,
           TABLE_NAME,
           REFERENCED_TABLE_NAME
    FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
    WHERE CONSTRAINT_SCHEMA = 'node_express_mysql';

Upvotes: 0

Related Questions