Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
docs: Mention new AddIndexConcurrently operation in migration doc.
Mateusz Manderaddcb919e4d1d
diff --git a/docs/subsystems/schema-migrations.md b/docs/subsystems/schema-migrations.mdindex 8d86481cd24..c69fcd75353 100644--- a/docs/subsystems/schema-migrations.md+++ b/docs/subsystems/schema-migrations.md@@ -42,14 +42,18 @@ migrations.prompt unnecessarily less, but it will update the working tree foryou automatically (you still need to do all the `git add`commands, etc.).-* **Large tables**: For our very largest tables (e.g. Message andUserMessage), we often need to take precautions when adding columnsto the table, performing data backfills, or building indexes. Wehave a `zerver/lib/migrate.py` library to help with adding columns- and backfilling data. For building indexes on these tables, we- should do this using SQL with PostgreSQL's CONCURRENTLY keyword.-+ and backfilling data.+* **Adding indexes** Regular `CREATE INDEX` SQL (corresponding to Django's+ `AddIndex` operation) locks writes to the affected table. This can be+ problematic when dealing with larger tables in particular and we've+ generally preferred to use `CREATE INDEX CONCURRENTLY` to allow the index+ to be built while the server is active. While in historical migrations+ we've used `RunSQL` directly, newer versions of Django add the corresponding+ operation `AddIndexConcurrently` and thus that's what should normally be used.* **Atomicity**. By default, each Django migration is run atomicallyinside a transaction. This can be problematic if one wants to dosomething in a migration that touches a lot of data and would best