# Generated by Django 4.2.16 on 2025-08-23 06:48

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('B_main', '0014_person_소개글'),
    ]

    operations = [
        migrations.CreateModel(
            name='AccessLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('action', models.CharField(choices=[('LOGIN', '로그인'), ('LOGOUT', '로그아웃'), ('SIGNUP', '회원가입'), ('PROFILE_UPDATE', '회원정보수정'), ('PASSWORD_CHANGE', '비밀번호변경'), ('PHONE_VERIFICATION', '전화번호인증'), ('SEARCH', '검색'), ('VIEW_PROFILE', '프로필조회'), ('MAIN_ACCESS', '메인페이지접속'), ('ERROR', '에러발생'), ('OTHER', '기타')], max_length=20, verbose_name='활동유형')),
                ('description', models.TextField(blank=True, null=True, verbose_name='상세설명')),
                ('ip_address', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP주소')),
                ('user_agent', models.TextField(blank=True, null=True, verbose_name='사용자에이전트')),
                ('session_key', models.CharField(blank=True, max_length=40, null=True, verbose_name='세션키')),
                ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='발생시간')),
                ('metadata', models.JSONField(blank=True, default=dict, verbose_name='추가정보')),
                ('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='B_main.person', verbose_name='Person')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='사용자')),
            ],
            options={
                'verbose_name': '접속 로그',
                'verbose_name_plural': '접속 로그들',
                'ordering': ['-timestamp'],
                'indexes': [models.Index(fields=['user', '-timestamp'], name='B_main_acce_user_id_28481c_idx'), models.Index(fields=['action', '-timestamp'], name='B_main_acce_action_2076f4_idx'), models.Index(fields=['-timestamp'], name='B_main_acce_timesta_6c0a5c_idx'), models.Index(fields=['ip_address', '-timestamp'], name='B_main_acce_ip_addr_ce96a0_idx')],
            },
        ),
    ]
