mirror of https://github.com/zulip/zulip.git
models: Migrate ids of UserActivity and UserActivityInterval to bigint.
These models have no external references, and are among the larger tables. Migrate them to bigints, starting with `useractivityinterval` which is less likely to be being touched.
This commit is contained in:
parent
4f4725f810
commit
37803406e5
|
@ -0,0 +1,26 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
atomic = False
|
||||
|
||||
dependencies = [
|
||||
("zerver", "0529_fts_bigint_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="useractivityinterval",
|
||||
name="id",
|
||||
field=models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="useractivity",
|
||||
name="id",
|
||||
field=models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
]
|
|
@ -19,6 +19,9 @@ class UserActivity(models.Model):
|
|||
and database migration purposes.
|
||||
"""
|
||||
|
||||
id = models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
)
|
||||
user_profile = models.ForeignKey(UserProfile, on_delete=CASCADE)
|
||||
client = models.ForeignKey(Client, on_delete=CASCADE)
|
||||
query = models.CharField(max_length=50, db_index=True)
|
||||
|
@ -33,6 +36,9 @@ class UserActivity(models.Model):
|
|||
class UserActivityInterval(models.Model):
|
||||
MIN_INTERVAL_LENGTH = timedelta(minutes=15)
|
||||
|
||||
id = models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
)
|
||||
user_profile = models.ForeignKey(UserProfile, on_delete=CASCADE)
|
||||
start = models.DateTimeField("start time", db_index=True)
|
||||
end = models.DateTimeField("end time", db_index=True)
|
||||
|
|
Loading…
Reference in New Issue