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(team): add updated_at to Project model (#60550)

Phil Haack12403b6247ce
diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.ts
index 6f01a87c40c5..7fa3d0403b06 100644
--- a/frontend/src/generated/core/api.schemas.ts
+++ b/frontend/src/generated/core/api.schemas.ts
@@ -593,7 +593,8 @@ export interface ProjectBackwardCompatApi {
readonly group_types: readonly ProjectBackwardCompatApiGroupTypesItem[]
/** @nullable */
readonly live_events_token: string | null
- readonly updated_at: string
+ /** @nullable */
+ readonly updated_at: string | null
readonly uuid: string
readonly api_token: string
app_urls?: (string | null)[]
@@ -1386,7 +1387,8 @@ export interface PatchedProjectBackwardCompatApi {
readonly group_types?: readonly PatchedProjectBackwardCompatApiGroupTypesItem[]
/** @nullable */
readonly live_events_token?: string | null
- readonly updated_at?: string
+ /** @nullable */
+ readonly updated_at?: string | null
readonly uuid?: string
readonly api_token?: string
app_urls?: (string | null)[]
diff --git a/posthog/api/test/__snapshots__/test_annotation.ambr b/posthog/api/test/__snapshots__/test_annotation.ambr
index 8f8fd085790c..4e2c9f2ccf5d 100644
--- a/posthog/api/test/__snapshots__/test_annotation.ambr
+++ b/posthog/api/test/__snapshots__/test_annotation.ambr
@@ -220,7 +220,8 @@
# ---
# name: TestAnnotation.test_retrieving_annotation_is_not_n_plus_1.11
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
@@ -844,7 +845,8 @@
# ---
# name: TestAnnotation.test_retrieving_annotation_is_not_n_plus_1.20
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
@@ -1116,7 +1118,8 @@
# ---
# name: TestAnnotation.test_retrieving_annotation_is_not_n_plus_1.3
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
diff --git a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr
index 331fc54b672a..fe4702bb45c1 100644
--- a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr
+++ b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr
@@ -261,7 +261,8 @@
# ---
# name: TestNotebooks.test_updates_notebook.12
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
@@ -1149,7 +1150,8 @@
# ---
# name: TestNotebooks.test_updates_notebook.3
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
@@ -1294,7 +1296,8 @@
# ---
# name: TestNotebooks.test_updates_notebook.31
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
diff --git a/posthog/migrations/1194_project_updated_at.py b/posthog/migrations/1194_project_updated_at.py
new file mode 100644
index 000000000000..75b580d2193c
--- /dev/null
+++ b/posthog/migrations/1194_project_updated_at.py
@@ -0,0 +1,15 @@
+# Generated by Django 5.2.14 on 2026-05-28 20:52
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("posthog", "1193_oauthaccesstoken_label_oauthapplication_scopes")]
+
+ operations = [
+ migrations.AddField(
+ model_name="project",
+ name="updated_at",
+ field=models.DateTimeField(auto_now=True, null=True),
+ ),
+ ]
diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt
index 91f3a6288c33..499806adcbb4 100644
--- a/posthog/migrations/max_migration.txt
+++ b/posthog/migrations/max_migration.txt
@@ -1 +1 @@
-1193_oauthaccesstoken_label_oauthapplication_scopes
+1194_project_updated_at
diff --git a/posthog/models/project.py b/posthog/models/project.py
index 75879c994023..0927d2fed198 100644
--- a/posthog/models/project.py
+++ b/posthog/models/project.py
@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional, cast
from django.core.validators import MinLengthValidator
from django.db import models, transaction
-from posthog.models.utils import sane_repr
+from posthog.models.utils import UpdatedMetaFields, sane_repr
if TYPE_CHECKING:
from posthog.models import Team, User
@@ -34,7 +34,7 @@ class ProjectManager(models.Manager):
return project, team
-class Project(models.Model):
+class Project(UpdatedMetaFields):
id = models.BigIntegerField(primary_key=True, verbose_name="ID") # Same as Team.id field
organization = models.ForeignKey(
"posthog.Organization",
diff --git a/products/actions/backend/api/test/__snapshots__/test_action.ambr b/products/actions/backend/api/test/__snapshots__/test_action.ambr
index 39e370d7f776..700fca4ccb14 100644
--- a/products/actions/backend/api/test/__snapshots__/test_action.ambr
+++ b/products/actions/backend/api/test/__snapshots__/test_action.ambr
@@ -220,7 +220,8 @@
# ---
# name: TestActionApi.test_listing_actions_is_not_nplus1.11
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
@@ -836,7 +837,8 @@
# ---
# name: TestActionApi.test_listing_actions_is_not_nplus1.20
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
@@ -1100,7 +1102,8 @@
# ---
# name: TestActionApi.test_listing_actions_is_not_nplus1.3
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
index 0d115ce66e49..a5e3e304056c 100644
--- a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
+++ b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
@@ -2596,7 +2596,8 @@
# ---
# name: TestFeatureFlag.test_creating_static_cohort.3
'''
- SELECT "posthog_project"."id",
+ SELECT "posthog_project"."updated_at",
+ "posthog_project"."id",
"posthog_project"."organization_id",
"posthog_project"."name",
"posthog_project"."created_at",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 04f7975a504b..81a79d18c484 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -30122,7 +30122,8 @@ export namespace Schemas {
readonly group_types?: readonly PatchedProjectBackwardCompatGroupTypesItem[];
/** @nullable */
readonly live_events_token?: string | null;
- readonly updated_at?: string;
+ /** @nullable */
+ readonly updated_at?: string | null;
readonly uuid?: string;
readonly api_token?: string;
app_urls?: (string | null)[];
@@ -33156,7 +33157,8 @@ export namespace Schemas {
readonly group_types: readonly ProjectBackwardCompatGroupTypesItem[];
/** @nullable */
readonly live_events_token: string | null;
- readonly updated_at: string;
+ /** @nullable */
+ readonly updated_at: string | null;
readonly uuid: string;
readonly api_token: string;
app_urls?: (string | null)[];