Chapter 8Referential Integrity Refactorings

Referential integrity refactorings are changes that ensure that a referenced row exists within another table and/or that ensures that a row that is no longer needed is removed appropriately. The referential integrity refactorings are as follows:

• Add Foreign Key Constraint

• Add Trigger For Calculated Column

• Drop Foreign Key Constraint

• Introduce Cascading Delete

• Introduce Hard Delete

• Introduce Soft Delete

• Introduce Trigger For History

Add Foreign Key Constraint

Add a foreign key constraint to an existing table to enforce a relationship to another table.

Motivation

The primary reason to apply Add Foreign Key Constraint is to enforce data dependencies at the database level, ...

Get Refactoring Databases: Evolutionary Database Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.