Commit 2268d9f2 authored by Toon Claes's avatar Toon Claes

Merge branch 'docs/add-migration-style-naming-conventions' into 'master'

Docs: Add naming conventions to migration style guide

See merge request gitlab-org/gitlab!60661
parents c8f16e8e 41b2d4b3
...@@ -114,6 +114,18 @@ rails schema statement: [`add_index`](https://api.rubyonrails.org/v5.2/classes/A ...@@ -114,6 +114,18 @@ rails schema statement: [`add_index`](https://api.rubyonrails.org/v5.2/classes/A
This is a blocking operation, but it doesn't cause problems because the table is not yet used, This is a blocking operation, but it doesn't cause problems because the table is not yet used,
and therefore it does not have any records yet. and therefore it does not have any records yet.
## Naming conventions
We keep column names consistent with [ActiveRecord's schema conventions](https://guides.rubyonrails.org/active_record_basics.html#schema-conventions).
Custom index names should follow the pattern `index_#{table_name}_on_#{column_1}_and_#{column_2}_#{condition}`.
Examples:
- `index_services_on_type_and_id_and_template_when_active`
- `index_projects_on_id_service_desk_enabled`
- `index_clusters_on_enabled_cluster_type_id_and_created_at`
## Heavy operations in a single transaction ## Heavy operations in a single transaction
When using a single-transaction migration, a transaction holds a database connection When using a single-transaction migration, a transaction holds a database connection
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment