Skip to content

: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.

feat(dashboards): validate dashboard tile widget constraints (4/11) (#60492)

Matt Pua97caf5ca3d0c
diff --git a/products/dashboards/backend/migrations/0010_validate_dashboardtile_check.py b/products/dashboards/backend/migrations/0010_validate_dashboardtile_check.py
new file mode 100644
index 000000000000..f6ae23479c53
--- /dev/null
+++ b/products/dashboards/backend/migrations/0010_validate_dashboardtile_check.py
@@ -0,0 +1,19 @@
+# Generated manually for dashboard widget entity
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("dashboards", "0009_dashboardtile_check_4way"),
+ ]
+
+ operations = [
+ migrations.RunSQL(
+ sql="""
+ ALTER TABLE "posthog_dashboardtile" VALIDATE CONSTRAINT "dash_tile_exactly_one_related_object";
+ ALTER TABLE "posthog_dashboardtile" VALIDATE CONSTRAINT "posthog_dashboardtile_widget_id_fk";
+ """,
+ reverse_sql=migrations.RunSQL.noop,
+ ),
+ ]
diff --git a/products/dashboards/backend/migrations/max_migration.txt b/products/dashboards/backend/migrations/max_migration.txt
index 56138bf2ddf4..b95ffc84269a 100644
--- a/products/dashboards/backend/migrations/max_migration.txt
+++ b/products/dashboards/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0009_dashboardtile_check_4way
+0010_validate_dashboardtile_check