# Generated by Django 4.0.2 on 2022-02-22 01:23

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='SessionLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('session_id', models.CharField(db_index=True, help_text='Django Session ID', max_length=127)),
                ('ip', models.CharField(blank=True, db_index=True, max_length=127, null=True)),
                ('user_agent', models.TextField(blank=True, help_text='Browser user agent', null=True)),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True, help_text='When session started')),
                ('is_closed', models.BooleanField(blank=True, db_index=True, default=False)),
                ('location', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sessions', to='location.geoip')),
                ('old_session', models.ForeignKey(blank=True, help_text='Previous session of same user agent', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='next_session', to='sessionlog.sessionlog')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sessions', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
