90 lines
3.9 KiB
Python
90 lines
3.9 KiB
Python
# Generated by Django 5.2.16 on 2026-07-31 01:19
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
import infrasynth.shared.enums
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
|
|
dependencies = []
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="ChannelConfig",
|
|
fields=[
|
|
("slug", models.SlugField(max_length=100, primary_key=True, serialize=False)),
|
|
("channel_type", models.CharField(choices=infrasynth.shared.enums.ChannelType.choices, max_length=20)),
|
|
("display_name", models.CharField(max_length=200)),
|
|
("config", models.JSONField(default=dict)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("priority", models.PositiveSmallIntegerField(default=0)),
|
|
],
|
|
options={
|
|
"db_table": "notifications_channel_config",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="NotificationTemplate",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("slug", models.SlugField(max_length=100)),
|
|
("name", models.CharField(max_length=200)),
|
|
("channel", models.CharField(choices=infrasynth.shared.enums.ChannelType.choices, max_length=20)),
|
|
("subject_template", models.CharField(max_length=500)),
|
|
("body_template", models.TextField()),
|
|
("is_html", models.BooleanField(default=False)),
|
|
("namespace", models.CharField(blank=True, default="", max_length=100)),
|
|
("metadata", models.JSONField(default=dict)),
|
|
],
|
|
options={
|
|
"db_table": "notifications_template",
|
|
"unique_together": {("slug", "namespace")},
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="NotificationDispatch",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("recipient", models.CharField(max_length=255)),
|
|
("channel", models.CharField(choices=infrasynth.shared.enums.ChannelType.choices, max_length=20)),
|
|
("subject", models.CharField(max_length=500)),
|
|
("body", models.TextField()),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("pending", "Pending"),
|
|
("sent", "Sent"),
|
|
("failed", "Failed"),
|
|
("retrying", "Retrying"),
|
|
],
|
|
default="pending",
|
|
max_length=20,
|
|
),
|
|
),
|
|
("error_message", models.TextField(blank=True, default="")),
|
|
("attempt", models.PositiveSmallIntegerField(default=0)),
|
|
("next_retry_at", models.DateTimeField(blank=True, null=True)),
|
|
("context_snapshot", models.JSONField(blank=True, default=dict)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("completed_at", models.DateTimeField(blank=True, null=True)),
|
|
("request_id", models.UUIDField(blank=True, null=True)),
|
|
(
|
|
"template",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="dispatches",
|
|
to="infrasynth_notifications.notificationtemplate",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"db_table": "notifications_dispatch",
|
|
},
|
|
),
|
|
]
|