81 lines
2.9 KiB
Python
81 lines
2.9 KiB
Python
# Generated by Django 5.2.12 on 2026-03-11 10:22
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
("workspaces", "0001_initial"),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Client",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.UUIDField(
|
|
default=uuid.uuid7, primary_key=True, serialize=False
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
("deleted_at", models.DateTimeField(blank=True, null=True)),
|
|
("is_deleted", models.BooleanField(default=False)),
|
|
("is_active", models.BooleanField(default=False)),
|
|
("name", models.CharField(max_length=255)),
|
|
("notes", models.TextField(blank=True)),
|
|
(
|
|
"created_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="created_%(app_label)s_%(class)s_set",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"updated_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="updated_%(app_label)s_%(class)s_set",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"workspace",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="clients",
|
|
to="workspaces.workspace",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"db_table": "client",
|
|
"ordering": ("-updated_at", "-created_at"),
|
|
"indexes": [
|
|
models.Index(fields=["id"], name="client_id_idx"),
|
|
models.Index(fields=["workspace"], name="client_workspace_idx"),
|
|
],
|
|
"constraints": [
|
|
models.UniqueConstraint(
|
|
condition=models.Q(("is_deleted", False)),
|
|
fields=("workspace", "name"),
|
|
name="unique_client_name_per_workspace",
|
|
)
|
|
],
|
|
},
|
|
),
|
|
]
|