agdar/core/migrations/0006_add_consent_token.py
2025-11-02 14:35:35 +03:00

38 lines
2.1 KiB
Python

# Generated by Django 5.2.3 on 2025-10-30 14:01
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_add_consent_template'),
]
operations = [
migrations.CreateModel(
name='ConsentToken',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
('token', models.CharField(help_text='Secure token for accessing consent form', max_length=64, unique=True, verbose_name='Token')),
('email', models.EmailField(help_text='Email address where consent link was sent', max_length=254, verbose_name='Email Address')),
('expires_at', models.DateTimeField(help_text='Token expiration date/time', verbose_name='Expires At')),
('used_at', models.DateTimeField(blank=True, help_text='When the token was used to sign consent', null=True, verbose_name='Used At')),
('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
('consent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tokens', to='core.consent', verbose_name='Consent')),
('sent_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sent_consent_tokens', to=settings.AUTH_USER_MODEL, verbose_name='Sent By')),
],
options={
'verbose_name': 'Consent Token',
'verbose_name_plural': 'Consent Tokens',
'ordering': ['-created_at'],
'indexes': [models.Index(fields=['token'], name='core_consen_token_5e0089_idx'), models.Index(fields=['email'], name='core_consen_email_e1aa6d_idx'), models.Index(fields=['expires_at'], name='core_consen_expires_480f3b_idx')],
},
),
]