diff --git a/zerver/migrations/0530_alter_useractivity_id_alter_useractivityinterval_id.py b/zerver/migrations/0530_alter_useractivity_id_alter_useractivityinterval_id.py new file mode 100644 index 0000000000..0d4099f09b --- /dev/null +++ b/zerver/migrations/0530_alter_useractivity_id_alter_useractivityinterval_id.py @@ -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" + ), + ), + ] diff --git a/zerver/models/user_activity.py b/zerver/models/user_activity.py index 7f979ba1fe..c550e8abaa 100644 --- a/zerver/models/user_activity.py +++ b/zerver/models/user_activity.py @@ -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)