# Generated by Django 5.2.7 on 2025-11-02 21:42

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('igny8_core_auth', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Clusters',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('keywords_count', models.IntegerField(default=0)),
                ('volume', models.IntegerField(default=0)),
                ('mapped_pages', models.IntegerField(default=0)),
                ('status', models.CharField(default='active', max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('sector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.sector')),
                ('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.site')),
                ('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
            ],
            options={
                'db_table': 'igny8_clusters',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Keywords',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('keyword', models.CharField(db_index=True, max_length=255)),
                ('volume', models.IntegerField(default=0)),
                ('difficulty', models.IntegerField(default=0)),
                ('intent', models.CharField(choices=[('informational', 'Informational'), ('navigational', 'Navigational'), ('commercial', 'Commercial'), ('transactional', 'Transactional')], default='informational', max_length=50)),
                ('status', models.CharField(choices=[('active', 'Active'), ('pending', 'Pending'), ('archived', 'Archived')], default='pending', max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('cluster', models.ForeignKey(blank=True, limit_choices_to={'sector': models.F('sector')}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='keywords', to='planner.clusters')),
                ('sector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.sector')),
                ('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.site')),
                ('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
            ],
            options={
                'db_table': 'igny8_keywords',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddIndex(
            model_name='clusters',
            index=models.Index(fields=['name'], name='igny8_clust_name_0f98bb_idx'),
        ),
        migrations.AddIndex(
            model_name='clusters',
            index=models.Index(fields=['status'], name='igny8_clust_status_c50486_idx'),
        ),
        migrations.AddIndex(
            model_name='clusters',
            index=models.Index(fields=['site', 'sector'], name='igny8_clust_site_id_a9aee3_idx'),
        ),
        migrations.AddIndex(
            model_name='keywords',
            index=models.Index(fields=['keyword'], name='igny8_keywo_keyword_462bff_idx'),
        ),
        migrations.AddIndex(
            model_name='keywords',
            index=models.Index(fields=['status'], name='igny8_keywo_status_9a0dd6_idx'),
        ),
        migrations.AddIndex(
            model_name='keywords',
            index=models.Index(fields=['cluster'], name='igny8_keywo_cluster_d1ea95_idx'),
        ),
        migrations.AddIndex(
            model_name='keywords',
            index=models.Index(fields=['site', 'sector'], name='igny8_keywo_site_id_7bcb63_idx'),
        ),
    ]
