68 lines
3.4 KiB
Python
68 lines
3.4 KiB
Python
# Generated by Django 5.2.7 on 2026-05-26 15:01
|
|
|
|
import django.db.models.deletion
|
|
import django.utils.timezone
|
|
import uuid
|
|
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),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Ticket',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('public_id', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
|
|
('requester_name', models.CharField(max_length=120)),
|
|
('requester_email', models.EmailField(max_length=254)),
|
|
('subject', models.CharField(max_length=180)),
|
|
('description', models.TextField()),
|
|
('category', models.CharField(choices=[('technical', 'Technical'), ('billing', 'Billing'), ('access', 'Access'), ('general', 'General')], default='general', max_length=24)),
|
|
('priority', models.CharField(choices=[('low', 'Low'), ('normal', 'Normal'), ('high', 'High'), ('urgent', 'Urgent')], default='normal', max_length=16)),
|
|
('status', models.CharField(choices=[('new', 'New'), ('triage', 'In triage'), ('waiting', 'Waiting on requester'), ('resolved', 'Resolved')], default='new', max_length=24)),
|
|
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('assigned_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assigned_tickets', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'ordering': ['-updated_at', '-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='TicketReply',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('author_name', models.CharField(max_length=120)),
|
|
('author_email', models.EmailField(blank=True, max_length=254)),
|
|
('body', models.TextField()),
|
|
('is_staff_reply', models.BooleanField(default=False)),
|
|
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('author_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ticket_replies', to=settings.AUTH_USER_MODEL)),
|
|
('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='replies', to='core.ticket')),
|
|
],
|
|
options={
|
|
'ordering': ['created_at'],
|
|
},
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ticket',
|
|
index=models.Index(fields=['status', 'priority'], name='core_ticket_status_ecde4b_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ticket',
|
|
index=models.Index(fields=['created_at'], name='core_ticket_created_fe6f19_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ticket',
|
|
index=models.Index(fields=['public_id'], name='core_ticket_public__952cbe_idx'),
|
|
),
|
|
]
|