mirror of https://github.com/zulip/zulip.git
migrations: Squash analytics migrations.
Created using manage.py squashmigrations, with my patch to the Django migration optimizer to correctly collapse AddConstraints/RemoveConstraints operations.
This commit is contained in:
parent
a56e5079fd
commit
54ea20cc5b
|
@ -0,0 +1,224 @@
|
||||||
|
# Generated by Django 5.0.7 on 2024-08-13 20:16
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
replaces = [
|
||||||
|
("analytics", "0001_initial"),
|
||||||
|
("analytics", "0002_remove_huddlecount"),
|
||||||
|
("analytics", "0003_fillstate"),
|
||||||
|
("analytics", "0004_add_subgroup"),
|
||||||
|
("analytics", "0005_alter_field_size"),
|
||||||
|
("analytics", "0006_add_subgroup_to_unique_constraints"),
|
||||||
|
("analytics", "0007_remove_interval"),
|
||||||
|
("analytics", "0008_add_count_indexes"),
|
||||||
|
("analytics", "0009_remove_messages_to_stream_stat"),
|
||||||
|
("analytics", "0010_clear_messages_sent_values"),
|
||||||
|
("analytics", "0011_clear_analytics_tables"),
|
||||||
|
("analytics", "0012_add_on_delete"),
|
||||||
|
("analytics", "0013_remove_anomaly"),
|
||||||
|
("analytics", "0014_remove_fillstate_last_modified"),
|
||||||
|
("analytics", "0015_clear_duplicate_counts"),
|
||||||
|
("analytics", "0016_unique_constraint_when_subgroup_null"),
|
||||||
|
("analytics", "0017_regenerate_partial_indexes"),
|
||||||
|
("analytics", "0018_remove_usercount_active_users_audit"),
|
||||||
|
("analytics", "0019_remove_unused_counts"),
|
||||||
|
("analytics", "0020_alter_installationcount_id_alter_realmcount_id_and_more"),
|
||||||
|
("analytics", "0021_alter_fillstate_id"),
|
||||||
|
]
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
# Needed for foreign keys to core models like Realm.
|
||||||
|
("zerver", "0001_initial"),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="InstallationCount",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("property", models.CharField(max_length=32)),
|
||||||
|
("end_time", models.DateTimeField()),
|
||||||
|
("value", models.BigIntegerField()),
|
||||||
|
("subgroup", models.CharField(max_length=16, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"unique_together": set(),
|
||||||
|
"constraints": [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", False)),
|
||||||
|
fields=("property", "subgroup", "end_time"),
|
||||||
|
name="unique_installation_count",
|
||||||
|
),
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", True)),
|
||||||
|
fields=("property", "end_time"),
|
||||||
|
name="unique_installation_count_null_subgroup",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="RealmCount",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"realm",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("property", models.CharField(max_length=32)),
|
||||||
|
("end_time", models.DateTimeField()),
|
||||||
|
("value", models.BigIntegerField()),
|
||||||
|
("subgroup", models.CharField(max_length=16, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"indexes": [
|
||||||
|
models.Index(
|
||||||
|
fields=["property", "end_time"],
|
||||||
|
name="analytics_realmcount_property_end_time_3b60396b_idx",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
"unique_together": set(),
|
||||||
|
"constraints": [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", False)),
|
||||||
|
fields=("realm", "property", "subgroup", "end_time"),
|
||||||
|
name="unique_realm_count",
|
||||||
|
),
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", True)),
|
||||||
|
fields=("realm", "property", "end_time"),
|
||||||
|
name="unique_realm_count_null_subgroup",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="StreamCount",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"realm",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"stream",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.stream"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("property", models.CharField(max_length=32)),
|
||||||
|
("end_time", models.DateTimeField()),
|
||||||
|
("value", models.BigIntegerField()),
|
||||||
|
("subgroup", models.CharField(max_length=16, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"indexes": [
|
||||||
|
models.Index(
|
||||||
|
fields=["property", "realm", "end_time"],
|
||||||
|
name="analytics_streamcount_property_realm_id_end_time_155ae930_idx",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
"unique_together": set(),
|
||||||
|
"constraints": [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", False)),
|
||||||
|
fields=("stream", "property", "subgroup", "end_time"),
|
||||||
|
name="unique_stream_count",
|
||||||
|
),
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", True)),
|
||||||
|
fields=("stream", "property", "end_time"),
|
||||||
|
name="unique_stream_count_null_subgroup",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="UserCount",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"realm",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"user",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("property", models.CharField(max_length=32)),
|
||||||
|
("end_time", models.DateTimeField()),
|
||||||
|
("value", models.BigIntegerField()),
|
||||||
|
("subgroup", models.CharField(max_length=16, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"indexes": [
|
||||||
|
models.Index(
|
||||||
|
fields=["property", "realm", "end_time"],
|
||||||
|
name="analytics_usercount_property_realm_id_end_time_591dbec1_idx",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
"unique_together": set(),
|
||||||
|
"constraints": [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", False)),
|
||||||
|
fields=("user", "property", "subgroup", "end_time"),
|
||||||
|
name="unique_user_count",
|
||||||
|
),
|
||||||
|
models.UniqueConstraint(
|
||||||
|
condition=models.Q(("subgroup__isnull", True)),
|
||||||
|
fields=("user", "property", "end_time"),
|
||||||
|
name="unique_user_count_null_subgroup",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="FillState",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("property", models.CharField(max_length=40, unique=True)),
|
||||||
|
("end_time", models.DateTimeField()),
|
||||||
|
("state", models.PositiveSmallIntegerField()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in New Issue