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.1 on 2026-03-17 05:57

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 = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("account_v2", "0004_user_is_service_account"),
    ]

    operations = [
        migrations.CreateModel(
            name="PlatformApiKey",
            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,
                    ),
                ),
                ("name", models.CharField(max_length=128)),
                ("description", models.TextField(max_length=512)),
                ("key", models.UUIDField(default=uuid.uuid4, unique=True)),
                ("is_active", models.BooleanField(default=True)),
                (
                    "permission",
                    models.CharField(
                        choices=[("read", "Read"), ("read_write", "Read/Write")],
                        default="read_write",
                        max_length=16,
                    ),
                ),
                (
                    "api_user",
                    models.OneToOneField(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="platform_api_key_identity",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="platform_api_keys_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        blank=True,
                        db_comment="Foreign key reference to the Organization model.",
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="account_v2.organization",
                    ),
                ),
            ],
            options={
                "db_table": "platform_api_key",
            },
        ),
        migrations.AddConstraint(
            model_name="platformapikey",
            constraint=models.UniqueConstraint(
                fields=("name", "organization"),
                name="unique_platform_api_key_name_per_org",
            ),
        ),
    ]