diff --git a/plugin-server/src/types.ts b/plugin-server/src/types.ts index 1263a896d04a3..56c0be261ef3e 100644 --- a/plugin-server/src/types.ts +++ b/plugin-server/src/types.ts @@ -646,7 +646,7 @@ export interface Team { test_account_filters: | (EventPropertyFilter | PersonPropertyFilter | ElementPropertyFilter | CohortPropertyFilter)[] | null - cookieless_server_hash_mode: CookielessServerHashMode | null + cookieless_server_hash_mode: CookielessServerHashMode timezone: string } diff --git a/plugin-server/tests/helpers/sql.ts b/plugin-server/tests/helpers/sql.ts index 751bdd9692c30..ceeeb4f60a524 100644 --- a/plugin-server/tests/helpers/sql.ts +++ b/plugin-server/tests/helpers/sql.ts @@ -2,6 +2,7 @@ import { DateTime } from 'luxon' import { defaultConfig } from '../../src/config/config' import { + CookielessServerHashMode, Hub, InternalPerson, Plugin, @@ -260,6 +261,7 @@ export async function createUserTeamAndOrganization( data_attributes: ['data-attr'], person_display_name_properties: [], access_control: false, + cookieless_server_hash_mode: CookielessServerHashMode.Disabled, }) } @@ -383,6 +385,7 @@ export const createTeam = async ( data_attributes: ['data-attr'], person_display_name_properties: [], access_control: false, + cookieless_server_hash_mode: CookielessServerHashMode.Disabled, }) return id } diff --git a/plugin-server/tests/main/db.test.ts b/plugin-server/tests/main/db.test.ts index cf47cb7ed0167..9faf62a137be7 100644 --- a/plugin-server/tests/main/db.test.ts +++ b/plugin-server/tests/main/db.test.ts @@ -2,7 +2,15 @@ import { DateTime } from 'luxon' import { Pool } from 'pg' import { defaultConfig } from '../../src/config/config' -import { Hub, Person, PropertyOperator, PropertyUpdateOperation, RawAction, Team } from '../../src/types' +import { + CookielessServerHashMode, + Hub, + Person, + PropertyOperator, + PropertyUpdateOperation, + RawAction, + Team, +} from '../../src/types' import { DB } from '../../src/utils/db/db' import { DependencyUnavailableError } from '../../src/utils/db/error' import { closeHub, createHub } from '../../src/utils/db/hub' @@ -866,7 +874,7 @@ describe('DB', () => { uuid: expect.any(String), person_display_name_properties: [], test_account_filters: {} as any, // NOTE: Test insertion data gets set as an object weirdly - cookieless_server_hash_mode: null, + cookieless_server_hash_mode: CookielessServerHashMode.Disabled, timezone: 'UTC', } as Team) }) @@ -898,7 +906,7 @@ describe('DB', () => { slack_incoming_webhook: null, uuid: expect.any(String), test_account_filters: {} as any, // NOTE: Test insertion data gets set as an object weirdly - cookieless_server_hash_mode: null, + cookieless_server_hash_mode: CookielessServerHashMode.Disabled, timezone: 'UTC', } as Team) }) diff --git a/posthog/migrations/0534_team_cookieless_server_hash_mode.py b/posthog/migrations/0534_team_cookieless_server_hash_mode.py index 9a35fb224f5d8..5a69ce289017c 100644 --- a/posthog/migrations/0534_team_cookieless_server_hash_mode.py +++ b/posthog/migrations/0534_team_cookieless_server_hash_mode.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.15 on 2024-12-19 13:12 +# Generated by Django 4.2.15 on 2024-12-19 15:05 from django.db import migrations, models @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="team", name="cookieless_server_hash_mode", - field=models.SmallIntegerField( - choices=[(0, "Disabled"), (1, "Stateless"), (2, "Stateful")], default=0, null=True - ), + field=models.SmallIntegerField(choices=[(0, "Disabled"), (1, "Stateless"), (2, "Stateful")], default=0), ), ] diff --git a/posthog/models/team/team.py b/posthog/models/team/team.py index 1c2809900c156..bd7beb569da18 100644 --- a/posthog/models/team/team.py +++ b/posthog/models/team/team.py @@ -283,7 +283,7 @@ class Meta: live_events_columns: ArrayField = ArrayField(models.TextField(), null=True, blank=True) recording_domains: ArrayField = ArrayField(models.CharField(max_length=200, null=True), blank=True, null=True) cookieless_server_hash_mode = models.SmallIntegerField( - default=CookielessServerHashMode.DISABLED, choices=CookielessServerHashMode.choices, null=True + default=CookielessServerHashMode.DISABLED, choices=CookielessServerHashMode.choices ) primary_dashboard = models.ForeignKey(