mirror of https://github.com/zulip/zulip.git
Add some docs on schema migrations.
This commit is contained in:
parent
94cca8b758
commit
52764763c6
|
@ -0,0 +1,23 @@
|
||||||
|
# Schema Migrations
|
||||||
|
|
||||||
|
Zulip uses the [standard Django system for doing schema
|
||||||
|
migrations](https://docs.djangoproject.com/en/1.8/topics/migrations/).
|
||||||
|
There is some example usage in the Zulip new feature tutorial on
|
||||||
|
readthedocs.
|
||||||
|
|
||||||
|
This page documents some important issues related to writing schema
|
||||||
|
migrations.
|
||||||
|
|
||||||
|
* **Large tables**: For large tables like Message and UserMessage, you
|
||||||
|
want to take precautions when adding columns to the table,
|
||||||
|
performing data backfills, or building indexes. We have 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 postgres's CONCURRENTLY keyword.
|
||||||
|
|
||||||
|
* **Numbering conflicts across branches**: If you've done your schema
|
||||||
|
change in a branch, and meanwhile another schema change has taken
|
||||||
|
place, Django will now have two migrations with the same number. To
|
||||||
|
fix this, you can just rename the file, as long as no other
|
||||||
|
migrations depend on it (in which case you also need to update the
|
||||||
|
dependencies).
|
Loading…
Reference in New Issue