diff options
Diffstat (limited to 'doc/development/database')
9 files changed, 20 insertions, 19 deletions
diff --git a/doc/development/database/add_foreign_key_to_existing_column.md b/doc/development/database/add_foreign_key_to_existing_column.md index 85411ff9aa7..a5d40d455d8 100644 --- a/doc/development/database/add_foreign_key_to_existing_column.md +++ b/doc/development/database/add_foreign_key_to_existing_column.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Adding foreign key constraint to an existing column @@ -79,7 +79,7 @@ class AddNotValidForeignKeyToEmailsUser < ActiveRecord::Migration[5.2] end ``` -CAUTION: **Caution:** +WARNING: Avoid using the `add_foreign_key` constraint more than once per migration file, unless the source and target tables are identical. #### Data migration to fix existing records @@ -119,7 +119,7 @@ end Validating the foreign key will scan the whole table and make sure that each relation is correct. -NOTE: **Note:** +NOTE: When using [background migrations](../background_migrations.md), foreign key validation should happen in the next GitLab release. Migration file for validating the foreign key: diff --git a/doc/development/database/constraint_naming_convention.md b/doc/development/database/constraint_naming_convention.md index 63a2d607ac5..debf74d3b40 100644 --- a/doc/development/database/constraint_naming_convention.md +++ b/doc/development/database/constraint_naming_convention.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Constraints naming conventions @@ -17,7 +17,7 @@ Please note that the intent is not to retroactively change names in existing dat | **Foreign Key** | `fk_<table name>_<column name>[_and_<column name>]*_<foreign table name>` | | `fk_projects_group_id_groups` | | **Index** | `index_<table name>_on_<column name>[_and_<column name>]*[_and_<column name in partial clause>]*` | | `index_repositories_on_group_id` | | **Unique Constraint** | `unique_<table name>_<column name>[_and_<column name>]*` | | `unique_projects_group_id_and_name` | -| **Check Constraint** | `check_<table name>_<column name>[_and_<column name>]*[_<suffix>]?` | The optional suffix should denote the type of validation, such as `length` and `enum`. It can also be used to desambiguate multiple `CHECK` constraints on the same column. | `check_projects_name_length`<br />`check_projects_type_enum`<br />`check_projects_admin1_id_and_admin2_id_differ` | +| **Check Constraint** | `check_<table name>_<column name>[_and_<column name>]*[_<suffix>]?` | The optional suffix should denote the type of validation, such as `length` and `enum`. It can also be used to disambiguate multiple `CHECK` constraints on the same column. | `check_projects_name_length`<br />`check_projects_type_enum`<br />`check_projects_admin1_id_and_admin2_id_differ` | | **Exclusion Constraint** | `excl_<table name>_<column name>[_and_<column name>]*_[_<suffix>]?` | The optional suffix should denote the type of exclusion being performed. | `excl_reservations_start_at_end_at_no_overlap` | ## Observations diff --git a/doc/development/database/database_reviewer_guidelines.md b/doc/development/database/database_reviewer_guidelines.md index 3345df8b46b..26083183d6d 100644 --- a/doc/development/database/database_reviewer_guidelines.md +++ b/doc/development/database/database_reviewer_guidelines.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Database Reviewer Guidelines diff --git a/doc/development/database/index.md b/doc/development/database/index.md index 19159c6c0ff..367ef455898 100644 --- a/doc/development/database/index.md +++ b/doc/development/database/index.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Database guides @@ -59,6 +59,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w - [Client-side connection-pool](client_side_connection_pool.md) - [Updating multiple values](setting_multiple_values.md) - [Constraints naming conventions](constraint_naming_convention.md) +- [Query performance guidelines](../query_performance.md) ## Case studies diff --git a/doc/development/database/maintenance_operations.md b/doc/development/database/maintenance_operations.md index c84ec31471e..9e7a35531ca 100644 --- a/doc/development/database/maintenance_operations.md +++ b/doc/development/database/maintenance_operations.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Maintenance operations diff --git a/doc/development/database/not_null_constraints.md b/doc/development/database/not_null_constraints.md index 96271863d94..01d5b7af7f1 100644 --- a/doc/development/database/not_null_constraints.md +++ b/doc/development/database/not_null_constraints.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # `NOT NULL` constraints @@ -66,7 +66,7 @@ different releases: - Add a post-deployment migration to add the `NOT NULL` constraint with `validate: false`. - Add a post-deployment migration to fix the existing records. - NOTE: **Note:** + NOTE: Depending on the size of the table, a background migration for cleanup could be required in the next release. See the [`NOT NULL` constraints on large tables](not_null_constraints.md#not-null-constraints-on-large-tables) section for more information. @@ -94,7 +94,7 @@ that all epics should have a user-generated description. After checking our production database, we know that there are `epics` with `NULL` descriptions, so we can not add and validate the constraint in one step. -NOTE: **Note:** +NOTE: Even if we did not have any epic with a `NULL` description, another instance of GitLab could have such records, so we would follow the same process either way. diff --git a/doc/development/database/setting_multiple_values.md b/doc/development/database/setting_multiple_values.md index c354247a9f8..54870380047 100644 --- a/doc/development/database/setting_multiple_values.md +++ b/doc/development/database/setting_multiple_values.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Setting Multiple Values diff --git a/doc/development/database/strings_and_the_text_data_type.md b/doc/development/database/strings_and_the_text_data_type.md index fe8cfa5cd22..8b839e929c7 100644 --- a/doc/development/database/strings_and_the_text_data_type.md +++ b/doc/development/database/strings_and_the_text_data_type.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Strings and the Text data type @@ -17,7 +17,7 @@ The `text` data type can not be defined with a limit, so `add_text_limit` is enf adding a [check constraint](https://www.postgresql.org/docs/11/ddl-constraints.html) on the column and then validating it at a followup step. -## Background info +## Background information The reason we always want to use `text` instead of `string` is that `string` columns have the disadvantage that if you want to update their limit, you have to run an `ALTER TABLE ...` command. @@ -133,7 +133,7 @@ Adding text limits to existing database columns requires multiple steps split in - Add a post-deployment migration to add the limit to the text column with `validate: false`. - Add a post-deployment migration to fix the existing records. - NOTE: **Note:** + NOTE: Depending on the size of the table, a background migration for cleanup could be required in the next release. See [text limit constraints on large tables](strings_and_the_text_data_type.md#text-limit-constraints-on-large-tables) for more information. @@ -154,7 +154,7 @@ other processes that try to access it while running the update. Also, after checking our production database, we know that there are `issues` with more characters in their title than the 1024 character limit, so we can not add and validate the constraint in one step. -NOTE: **Note:** +NOTE: Even if we did not have any record with a title larger than the provided limit, another instance of GitLab could have such records, so we would follow the same process either way. @@ -256,7 +256,7 @@ end To keep this guide short, we skipped the definition of the background migration and only provided a high level example of the post-deployment migration that is used to schedule the batches. -You can find more info on the guide about [background migrations](../background_migrations.md) +You can find more information on the guide about [background migrations](../background_migrations.md) #### Validate the text limit (next release) diff --git a/doc/development/database/table_partitioning.md b/doc/development/database/table_partitioning.md index 30d0b0a2f5b..358b9bb42b0 100644 --- a/doc/development/database/table_partitioning.md +++ b/doc/development/database/table_partitioning.md @@ -1,7 +1,7 @@ --- stage: Enablement group: Database -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- # Database table partitioning @@ -98,7 +98,7 @@ CREATE TABLE audit_events ( PARTITION BY RANGE(created_at); ``` -NOTE: **Note:** +NOTE: The primary key of a partitioned table must include the partition key as part of the primary key definition. |