Foreign Key - CI/CD用語集の定義
foreign keyは、別のテーブルのprimary keyを参照する列で、参照先の行が存在することを強制します。これはリレーションシップをデータベースレベルで表現したものです。
マイグレーションにおいて
foreign keyは操作の順序を制約します。子がまだ参照している間は、参照先の行やテーブルを削除できません。そのため、マイグレーションスクリプトでは大量データ変更の前後でconstraintを追加・削除することがよくあります。
関連ガイド
Primary Key - CI/CD Glossary DefinitionPrimary Key: A primary key is the column (or set of columns) that uniquely identifies each row in a table. It…
Referential Integrity - CI/CD Glossary DefinitionReferential Integrity: Referential integrity is the guarantee that every foreign key points at a row that act…
Database Index - CI/CD Glossary DefinitionDatabase Index: A database index is an auxiliary data structure (usually a B-tree) that lets the database fin…