:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
# Generated by Django 5.2.14 on 2026-07-17 22:49
import django.db.models.deletion
import django.contrib.postgres.fields
from django.conf import settings
from django.db import migrations, models
import posthog.uuidt
class Migration(migrations.Migration):
dependencies = [
("logs", "0016_logsview_columns"),
("posthog", "1258_duckgressinkschemastate_queue_last_applied_at"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="LogsMetricRule",
fields=[
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True, null=True)),
(
"id",
models.UUIDField(
default=posthog.uuidt.uuid7,
editable=False,
primary_key=True,
serialize=False,
),
),
("name", models.CharField(max_length=255)),
("metric_name", models.CharField(max_length=200)),
("enabled", models.BooleanField(default=False)),
("filter_group", models.JSONField(blank=True, default=None, null=True)),
(
"value_attribute",
models.CharField(blank=True, max_length=512, null=True),
),
(
"group_by",
django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=512),
blank=True,
default=list,
size=None,
),
),
("version", models.PositiveIntegerField(default=1)),
(
"created_by",
models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
(
"team",
models.ForeignKey(
db_constraint=False,
on_delete=django.db.models.deletion.CASCADE,
to="posthog.team",
),
),
],
options={
"db_table": "logs_logsmetricrule",
"indexes": [
models.Index(
fields=["team_id", "enabled"],
name="logs_metric_team_enabled_idx",
)
],
"constraints": [
models.UniqueConstraint(
fields=("team", "metric_name"),
name="logs_metric_rule_team_metric_uniq",
)
],
},
),
]