summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-11-05 13:42:49 +0100
committerKamil Trzciński <ayufan@ayufan.eu>2018-11-05 13:42:49 +0100
commit73b9a83025c53b05fda5348923dc0c4cb9da2424 (patch)
tree9edf87e2c71944fcfd5eadfb5436f76b8337ea59
parent4716ff40e226815a2beb7a1445fbcf227d6afc84 (diff)
downloadgitlab-ce-validate-foreign-keys-being-indexed.tar.gz
Update migration style guidevalidate-foreign-keys-being-indexed
-rw-r--r--doc/development/migration_style_guide.md7
1 files changed, 1 insertions, 6 deletions
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 6f31e5b82e5..e4e532bb4ed 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -187,12 +187,7 @@ end
When adding a foreign-key constraint to either an existing or new
column remember to also add a index on the column.
-This is _required_ if the foreign-key constraint specifies
-`ON DELETE CASCADE` or `ON DELETE SET NULL` behavior. On a cascading
-delete, the [corresponding record needs to be retrieved using an
-index](https://www.cybertec-postgresql.com/en/postgresql-indexes-and-foreign-keys/)
-(otherwise, we'd need to scan the whole table) for subsequent update or
-deletion.
+This is _required_ for all foreign-keys.
Here's an example where we add a new column with a foreign key
constraint. Note it includes `index: true` to create an index for it.