From 428c4a4b9307d8af8b7afe584fe52b9310328d6a Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Thu, 5 Dec 2024 15:11:51 +0100 Subject: [PATCH] chore(environments): Sync project name with team name (#26638) --- posthog/migrations/0527_project_name_sync.py | 19 +++++++++++++++++++ posthog/migrations/max_migration.txt | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 posthog/migrations/0527_project_name_sync.py diff --git a/posthog/migrations/0527_project_name_sync.py b/posthog/migrations/0527_project_name_sync.py new file mode 100644 index 0000000000000..23c29ffe82fb1 --- /dev/null +++ b/posthog/migrations/0527_project_name_sync.py @@ -0,0 +1,19 @@ +# Created manually + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [("posthog", "0526_remoteconfig")] + + operations = [ + migrations.RunSQL( + """ + UPDATE posthog_project AS proj + SET name = team.name + FROM posthog_team AS team + WHERE proj.id = team.project_id AND proj.name != team.name""", + reverse_sql=migrations.RunSQL.noop, + elidable=True, + ), + ] diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index 4ef90b28a1e45..4dd4a8fb39bbc 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0526_remoteconfig +0527_project_name_sync