# Generated by Django 5.2.12 on 2026-04-16 02:04

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='DhcpLease',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip', models.GenericIPAddressField(db_index=True, unique=True)),
                ('mac', models.CharField(blank=True, max_length=17)),
                ('hostname', models.CharField(blank=True, max_length=200)),
                ('last_seen', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['ip'],
            },
        ),
        migrations.CreateModel(
            name='RouterMonSettings',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('enabled', models.BooleanField(default=True)),
                ('syslog_port', models.IntegerField(default=5514, help_text='UDP port to listen on for syslog datagrams. Default: 5514 (non-privileged). If your router only supports port 514, add an iptables redirect on the k3s node: iptables -t nat -A PREROUTING -p udp --dport 514 -j REDIRECT --to-port 5514')),
                ('excluded_clients', models.TextField(blank=True, default='', help_text='One LAN IP per line. DNS queries from these clients will not be stored.')),
                ('retention_days', models.IntegerField(default=7, help_text='Delete DNS query records older than this many days.')),
                ('last_received_at', models.DateTimeField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Router Monitor Settings',
                'verbose_name_plural': 'Router Monitor Settings',
            },
        ),
        migrations.CreateModel(
            name='DnsQuery',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField(db_index=True)),
                ('client_ip', models.GenericIPAddressField(db_index=True)),
                ('client_name', models.CharField(blank=True, help_text='Hostname from DHCP lease at query time', max_length=200)),
                ('domain', models.CharField(db_index=True, max_length=500)),
                ('query_type', models.CharField(default='A', max_length=20)),
                ('is_nxdomain', models.BooleanField(db_index=True, default=False)),
                ('resolved_ip', models.GenericIPAddressField(blank=True, null=True)),
                ('country', models.CharField(blank=True, max_length=100)),
                ('country_code', models.CharField(blank=True, max_length=10)),
                ('city', models.CharField(blank=True, max_length=100)),
            ],
            options={
                'ordering': ['-timestamp'],
                'indexes': [models.Index(fields=['client_ip', 'timestamp'], name='routermon_d_client__2d31fb_idx'), models.Index(fields=['domain', 'timestamp'], name='routermon_d_domain_ca0a82_idx'), models.Index(fields=['timestamp', 'is_nxdomain'], name='routermon_d_timesta_74c854_idx')],
            },
        ),
    ]
