Files
unstract/backend/api/migrations/0001_initial.py
2024-02-25 16:19:36 +05:30

186 lines
6.3 KiB
Python

# Generated by Django 4.2.1 on 2024-01-23 11:18
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),
("workflow", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="APIDeployment",
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,
),
),
(
"display_name",
models.CharField(
db_comment="User-given display name for the API.",
default="default api",
max_length=30,
unique=True,
),
),
(
"description",
models.CharField(
blank=True,
db_comment="User-given description for the API.",
default="",
max_length=255,
),
),
(
"is_active",
models.BooleanField(
db_comment="Flag indicating whether the API is active or not.",
default=True,
),
),
(
"api_endpoint",
models.CharField(
db_comment="URL endpoint for the API deployment.",
editable=False,
max_length=255,
unique=True,
),
),
(
"api_name",
models.CharField(
db_comment="Short name for the API deployment.",
default="default",
max_length=30,
unique=True,
),
),
(
"created_by",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="api_created_by",
to=settings.AUTH_USER_MODEL,
),
),
(
"modified_by",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="api_modified_by",
to=settings.AUTH_USER_MODEL,
),
),
(
"workflow",
models.ForeignKey(
db_comment="Foreign key reference to the Workflow model.",
on_delete=django.db.models.deletion.CASCADE,
to="workflow.workflow",
),
),
],
options={
"abstract": False,
},
),
migrations.CreateModel(
name="APIKey",
fields=[
("created_at", models.DateTimeField(auto_now_add=True)),
("modified_at", models.DateTimeField(auto_now=True)),
(
"id",
models.UUIDField(
db_comment="Unique identifier for the API key.",
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
(
"api_key",
models.UUIDField(
db_comment="Actual key UUID.",
default=uuid.uuid4,
editable=False,
unique=True,
),
),
(
"description",
models.CharField(
db_comment="Description of the API key.",
max_length=255,
null=True,
),
),
(
"is_active",
models.BooleanField(
db_comment="Flag indicating whether the API key is active or not.",
default=True,
),
),
(
"api",
models.ForeignKey(
db_comment="Foreign key reference to the APIDeployment model.",
on_delete=django.db.models.deletion.CASCADE,
to="api.apideployment",
),
),
(
"created_by",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="api_key_created_by",
to=settings.AUTH_USER_MODEL,
),
),
(
"modified_by",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="api_key_modified_by",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"abstract": False,
},
),
]