Files
GIA/core/migrations/0025_platformchatlink.py

57 lines
2.1 KiB
Python

from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0024_workspacemetricsnapshot"),
]
operations = [
migrations.CreateModel(
name="PlatformChatLink",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("service", models.CharField(choices=[("signal", "Signal"), ("whatsapp", "WhatsApp"), ("xmpp", "XMPP"), ("instagram", "Instagram")], max_length=255)),
("chat_identifier", models.CharField(max_length=255)),
("chat_jid", models.CharField(blank=True, max_length=255, null=True)),
("chat_name", models.CharField(blank=True, max_length=255, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"person",
models.ForeignKey(on_delete=models.deletion.CASCADE, to="core.person"),
),
(
"person_identifier",
models.ForeignKey(blank=True, null=True, on_delete=models.deletion.SET_NULL, to="core.personidentifier"),
),
(
"user",
models.ForeignKey(on_delete=models.deletion.CASCADE, to="core.user"),
),
],
),
migrations.AddConstraint(
model_name="platformchatlink",
constraint=models.UniqueConstraint(
fields=("user", "service", "chat_identifier"),
name="unique_platform_chat_link",
),
),
migrations.AddIndex(
model_name="platformchatlink",
index=models.Index(
fields=["user", "service", "chat_identifier"],
name="core_platfo_user_id_0436ca_idx",
),
),
]