Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-20 09:16:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-20 09:16:34 +0300
commit9b863f753f0320a95af1ff774cd0c1d4ec7d2754 (patch)
treed171048da8e1e825bb33399fd9a4a27a833c7dcb /doc/development/migration_style_guide.md
parente3523242123f949261d968ec942c6dc10ad6c772 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/migration_style_guide.md')
-rw-r--r--doc/development/migration_style_guide.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 47580f91af6..95f0692c3e6 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -935,6 +935,20 @@ NOTE:
`add_sequence` should be avoided for columns with foreign keys.
Adding sequence to these columns is **only allowed** in the down method (restore previous schema state).
+## Truncate a table
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117373) in GitLab 15.11.
+
+Truncating a table is uncommon, but you can use the `truncate_tables!` method provided by the database team.
+
+Under the hood, it works like this:
+
+- Finds the `gitlab_schema` for the tables to be truncated.
+- If the `gitlab_schema` for the tables is included in the connection's gitlab_schemas,
+ it then executes the `TRUNCATE` statement.
+- If the `gitlab_schema` for the tables is not included in the connection's
+ gitlab_schemas, it does nothing.
+
## Swapping primary key
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/98645) in GitLab 15.5.