summaryrefslogtreecommitdiff
path: root/doc/development/migration_style_guide.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/migration_style_guide.md')
-rw-r--r--doc/development/migration_style_guide.md27
1 files changed, 25 insertions, 2 deletions
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 086e061452b..aebecd90574 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -110,6 +110,11 @@ table, that column is added at the bottom. Please do not reorder
columns manually for existing tables as this causes confusion to
other people using `db/structure.sql` generated by Rails.
+NOTE:
+[Creating an index asynchronously requires two merge requests.](adding_database_indexes.md#add-a-migration-to-create-the-index-synchronously)
+When done, commit the schema change in the merge request
+that adds the index with `add_concurrent_index`.
+
When your local database in your GDK is diverging from the schema from
`main` it might be hard to cleanly commit the schema changes to
Git. In that case you can use the `scripts/regenerate-schema` script to
@@ -127,6 +132,24 @@ scripts/regenerate-schema
TARGET=12-9-stable-ee scripts/regenerate-schema
```
+The `scripts/regenerate-schema` script can create additional differences.
+If this happens, use a manual procedure where `<migration ID>` is the `DATETIME`
+part of the migration file.
+
+```shell
+# Rebase against master
+git rebase master
+
+# Rollback changes
+VERSION=<migration ID> bundle exec rails db:rollback:main
+
+# Checkout db/structure.sql from master
+git checkout origin/master db/structure.sql
+
+# Migrate changes
+VERSION=<migration ID> bundle exec rails db:migrate:main
+```
+
## Avoiding downtime
The document ["Avoiding downtime in migrations"](database/avoiding_downtime_in_migrations.md) specifies
@@ -487,7 +510,7 @@ end
### When to use the helper method
You can **only** use the `with_lock_retries` helper method when the execution is not already inside
-an open transaction (using Postgres subtransactions is discouraged). It can be used with
+an open transaction (using PostgreSQL subtransactions is discouraged). It can be used with
standard Rails migration helper methods. Calling more than one migration
helper is not a problem if they're executed on the same table.
@@ -602,7 +625,7 @@ end
```
You must explicitly name indexes that are created with more complex
-definitions beyond table name, column name(s) and uniqueness constraint.
+definitions beyond table name, column names, and uniqueness constraint.
Consult the [Adding Database Indexes](adding_database_indexes.md#requirements-for-naming-indexes)
guide for more details.