# Generated by Django 4.2.21 on 2025-08-28 22:30

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


class Migration(migrations.Migration):

    dependencies = [
        ('account', '0007_delete_userdevicelocation'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserDeviceLocation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip_address', models.GenericIPAddressField(db_index=True)),
                ('first_seen', models.DateTimeField(auto_now_add=True)),
                ('last_seen', models.DateTimeField(auto_now=True)),
                ('geolocation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='device_locations', to='account.geolocatedip')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='device_locations_direct', to=settings.AUTH_USER_MODEL)),
                ('user_device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='account.userdevice')),
            ],
            options={
                'ordering': ['-last_seen'],
                'unique_together': {('user', 'user_device', 'ip_address')},
            },
            bases=(models.Model, MojoModel),
        ),
    ]
