# Generated by Django 6.0 on 2026-02-17 11:04

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


class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='StagingColumn',
            fields=[
                ('staging_column_id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier of the staging column', primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Timestamp when the staging column was created')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Timestamp when the staging column was last updated')),
                ('prejoin_column', models.ForeignKey(blank=True, help_text='Prejoin extraction column (XOR with source_column)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='staging_representations', to='engine.prejoinextractioncolumn')),
                ('project', models.ForeignKey(help_text='Project this column belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='staging_columns', to='engine.project')),
                ('source_column', models.ForeignKey(blank=True, help_text='Direct source column (XOR with prejoin_column)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='staging_representations', to='engine.sourcecolumn')),
                ('source_table', models.ForeignKey(help_text='The base source table this column is associated with in staging', on_delete=django.db.models.deletion.CASCADE, related_name='staging_columns', to='engine.sourcetable')),
            ],
            options={
                'verbose_name': 'Staging Column',
                'verbose_name_plural': 'Staging Columns',
                'db_table': 'staging_column',
                'unique_together': {('source_table', 'source_column', 'prejoin_column')},
            },
        ),
        migrations.AddField(
            model_name='linkhubsourcemapping',
            name='staging_column',
            field=models.ForeignKey(blank=True, help_text='Unified staging column (will eventually replace source_column and prejoin_extraction_column)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='link_hub_mappings', to='engine.stagingcolumn'),
        ),
    ]
