diff --git a/src/backend/core/migrations/0002_calendarsubscriptiontoken.py b/src/backend/core/migrations/0002_calendarsubscriptiontoken.py new file mode 100644 index 0000000..5ad4c8d --- /dev/null +++ b/src/backend/core/migrations/0002_calendarsubscriptiontoken.py @@ -0,0 +1,34 @@ +# Generated by Django 5.2.9 on 2026-01-25 14:21 + +import django.db.models.deletion +import uuid +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='CalendarSubscriptionToken', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('caldav_path', models.CharField(help_text='CalDAV path of the calendar', max_length=512)), + ('calendar_name', models.CharField(blank=True, default='', help_text='Display name of the calendar', max_length=255)), + ('token', models.UUIDField(db_index=True, default=uuid.uuid4, help_text='Secret token used in the subscription URL', unique=True)), + ('is_active', models.BooleanField(default=True, help_text='Whether this subscription token is active')), + ('last_accessed_at', models.DateTimeField(blank=True, help_text='Last time this subscription URL was accessed', null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscription_tokens', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'calendar subscription token', + 'verbose_name_plural': 'calendar subscription tokens', + 'constraints': [models.UniqueConstraint(fields=('owner', 'caldav_path'), name='unique_token_per_owner_calendar')], + }, + ), + ] diff --git a/src/backend/core/migrations/0003_calendarsubscriptiontoken_token_active_idx.py b/src/backend/core/migrations/0003_calendarsubscriptiontoken_token_active_idx.py new file mode 100644 index 0000000..994ac29 --- /dev/null +++ b/src/backend/core/migrations/0003_calendarsubscriptiontoken_token_active_idx.py @@ -0,0 +1,17 @@ +# Generated by Django 5.2.9 on 2026-01-25 15:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_calendarsubscriptiontoken'), + ] + + operations = [ + migrations.AddIndex( + model_name='calendarsubscriptiontoken', + index=models.Index(fields=['token', 'is_active'], name='token_active_idx'), + ), + ]