Files
zulip/zerver/migrations/0525_userpresence_last_update_id.py
Mateusz Mandera 0dca8f2a38 models: New PresenceSequence model and UserPresence.last_update_id col.
Migration plan:
1. Add NULLable .last_update_id column to UserPresence with default 0
   for new objects.
2. Backfill the value to 0 for old UserPresences, can be done in the
   background while server is running.
3. Make the column non-NULL.
4. Add new model PresenceSequence and create its rows for old realms.
2024-06-02 22:08:28 -07:00

30 lines
1000 B
Python

# Generated by Django 5.0.5 on 2024-05-02 02:17
from django.db import migrations, models
class Migration(migrations.Migration):
atomic = False
dependencies = [
("zerver", "0524_remove_userprofile_onboarding_steps"),
]
operations = [
# Create a new column, making it NULLable to avoid locking the table
# rewriting rows with a non-NULL default value.
migrations.AddField(
model_name="userpresence",
name="last_update_id",
field=models.PositiveBigIntegerField(db_index=True, null=True),
),
# This is an SQL noop, since Django doesn't add defaults at database level.
# The default guarantees new rows will have a value. Old rows can get backfilled
# in the next migration.
migrations.AlterField(
model_name="userpresence",
name="last_update_id",
field=models.PositiveBigIntegerField(db_index=True, default=0, null=True),
),
]