Skip to content

Commit

Permalink
Do not assign existing chats to any region
Browse files Browse the repository at this point in the history
  • Loading branch information
svenseeberg committed Sep 23, 2024
1 parent 38d8e47 commit 574bd33
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
# Generated by Django 4.2.13 on 2024-09-19 06:36

import django.db.models.deletion
import psycopg
from django.db import migrations, models

from ...cms.models.chat.user_chat import UserChat
from ...cms.models.regions.region import Region


def set_chat_default_region() -> None:
"""
Set default region for existing chats
"""
try:
region_id = Region.objects.get(slug="testumgebung").id
except psycopg.errors.UndefinedTable:
region_id = 1
UserChat.objects.all().update(region=region_id)


class Migration(migrations.Migration):
"""
Expand Down Expand Up @@ -65,5 +50,4 @@ class Migration(migrations.Migration):
verbose_name="Zammad-URL",
),
),
migrations.RunPython(set_chat_default_region),
]

0 comments on commit 574bd33

Please sign in to comment.