# Generated by Django 5.0.4 on 2024-04-27 20:22

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

import django_user_sessions_ng.models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Session",
            fields=[
                (
                    "session_key",
                    models.CharField(
                        max_length=40,
                        primary_key=True,
                        serialize=False,
                        verbose_name="session key",
                    ),
                ),
                ("session_data", models.TextField(verbose_name="session data")),
                (
                    "expire_date",
                    models.DateTimeField(db_index=True, verbose_name="expire date"),
                ),
                ("ip", models.GenericIPAddressField(blank=True, null=True)),
                ("device", models.CharField(max_length=255, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="sessions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "session",
                "verbose_name_plural": "sessions",
                "db_table": "django_user_sessions_ng_user_sessions",
                "ordering": ("-created_at",),
                "abstract": False,
            },
            managers=[
                ("objects", django_user_sessions_ng.models.SessionManager()),
            ],
        ),
    ]
