# Generated by Django 5.0.3 on 2024-03-27 14:28

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),
    ]

    operations = [
        migrations.CreateModel(
            name="SSOToken",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "backend",
                    models.CharField(
                        help_text="The backend id for the token",
                        max_length=80,
                        verbose_name="Backend",
                    ),
                ),
                (
                    "token",
                    models.CharField(
                        help_text="The backend-specific token",
                        max_length=255,
                        verbose_name="Token",
                    ),
                ),
                (
                    "ctime",
                    models.DateTimeField(
                        auto_now_add=True,
                        db_index=True,
                        help_text="When the instance has been created",
                        verbose_name="Created",
                    ),
                ),
                (
                    "mtime",
                    models.DateTimeField(
                        auto_now=True,
                        db_index=True,
                        help_text="When the instance has been modified",
                        verbose_name="Modified",
                    ),
                ),
                (
                    "etime",
                    models.DateTimeField(
                        db_index=True,
                        editable=False,
                        help_text="When the instance should be expired, or has been expired",
                        null=True,
                        verbose_name="Expired",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="User to whom the token belongs",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="sso_tokens",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="User",
                    ),
                ),
            ],
            options={
                "verbose_name": "SSO Token",
                "verbose_name_plural": "SSO Tokens",
                "unique_together": {("backend", "token")},
            },
        ),
    ]
