# Generated by Django 5.2.8 on 2025-11-20 23:27

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('igny8_core_auth', '0001_initial'),
        # ('site_building', '0001_initial'),  # REMOVED: SiteBuilder deprecated
        ('writer', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='DeploymentRecord',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('version', models.IntegerField(help_text='Blueprint version being deployed')),
                ('deployed_version', models.IntegerField(blank=True, help_text='Currently deployed version (after successful deployment)', null=True)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('deploying', 'Deploying'), ('deployed', 'Deployed'), ('failed', 'Failed'), ('rolled_back', 'Rolled Back')], db_index=True, default='pending', max_length=20)),
                ('deployed_at', models.DateTimeField(blank=True, null=True)),
                ('deployment_url', models.URLField(blank=True, help_text='Public URL of deployed site', null=True)),
                ('error_message', models.TextField(blank=True, null=True)),
                ('metadata', models.JSONField(default=dict, help_text='Deployment metadata (build info, file paths, etc.)')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('account', models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.account')),
                ('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')),
                # ('site_blueprint', ...) REMOVED: SiteBuilder deprecated
            ],
            options={
                'db_table': 'igny8_deployment_records',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['status'], name='igny8_deplo_status_5cb014_idx'), models.Index(fields=['account', 'status'], name='igny8_deplo_tenant__4de41d_idx')],
            },
        ),
        migrations.CreateModel(
            name='PublishingRecord',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('destination', models.CharField(db_index=True, help_text="Destination platform: 'wordpress', 'sites', 'shopify'", max_length=50)),
                ('destination_id', models.CharField(blank=True, help_text='External ID in destination platform', max_length=255, null=True)),
                ('destination_url', models.URLField(blank=True, help_text='URL of published content/site', null=True)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('publishing', 'Publishing'), ('published', 'Published'), ('failed', 'Failed')], db_index=True, default='pending', max_length=20)),
                ('published_at', models.DateTimeField(blank=True, null=True)),
                ('error_message', models.TextField(blank=True, null=True)),
                ('metadata', models.JSONField(default=dict, help_text='Platform-specific metadata')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('account', models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.account')),
                ('content', models.ForeignKey(blank=True, help_text='Content being published (if publishing content)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='publishing_records', to='writer.content')),
                ('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')),
                # ('site_blueprint', ...) REMOVED: SiteBuilder deprecated
            ],
            options={
                'db_table': 'igny8_publishing_records',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['destination', 'status'], name='igny8_publi_destina_5706a3_idx'), models.Index(fields=['content', 'destination'], name='igny8_publi_content_3688ba_idx'), models.Index(fields=['account', 'status'], name='igny8_publi_tenant__2e0749_idx')],
            },
        ),
    ]
