Corp/backend/communications/migrations/0004_chatreadstate.py
2026-09-07 19:43:48 +03:00

60 lines
2.0 KiB
Python

# Generated by Django 5.2.4 on 2025-08-19 06:32
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("communications", "0003_alter_chat_department_alter_chat_participants"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="ChatReadState",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("last_read_at", models.DateTimeField(blank=True, null=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"chat",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="read_states",
to="communications.chat",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="chat_read_states",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"indexes": [
models.Index(
fields=["chat", "user"], name="communicati_chat_id_ac306b_idx"
),
models.Index(
fields=["chat", "last_read_at"],
name="communicati_chat_id_edefdb_idx",
),
],
"unique_together": {("chat", "user")},
},
),
]