Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

3.3 KB
Raw Blame
# Generated by Django 4.2.30 on 2026-10-21 10:02

import uuid

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("account_v2", "0007_organization_restrict_connector_creation"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="InboxItem",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("modified_at", models.DateTimeField(auto_now=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "kind",
                    models.CharField(
                        choices=[
                            ("resource_shared", "Resource shared"),
                            ("execution_failed", "Execution failed"),
                        ],
                        max_length=32,
                    ),
                ),
                ("title", models.CharField(max_length=255)),
                ("body", models.TextField(blank=True, default="")),
                (
                    "route",
                    models.JSONField(
                        blank=True,
                        db_comment="Where the item opens: {key, params} as in global search, or null",
                        null=True,
                    ),
                ),
                (
                    "dedupe_key",
                    models.CharField(
                        db_comment="Identifies the event, so it lands once per user",
                        max_length=255,
                    ),
                ),
                ("read_at", models.DateTimeField(blank=True, null=True)),
                (
                    "organization",
                    models.ForeignKey(
                        blank=True,
                        db_comment="Foreign key reference to the Organization model.",
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="account_v2.organization",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="inbox_items",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "db_table": "inbox_item",
                "indexes": [
                    models.Index(
                        fields=["organization", "user", "-created_at"],
                        name="inbox_item_user_newest",
                    )
                ],
            },
        ),
        migrations.AddConstraint(
            model_name="inboxitem",
            constraint=models.UniqueConstraint(
                fields=("organization", "user", "dedupe_key"),
                name="unique_inbox_item_per_event",
            ),
        ),
    ]