# Generated by Django for PgVectorStore

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.RunSQL(
            "CREATE EXTENSION IF NOT EXISTS vector;",
            reverse_sql="DROP EXTENSION IF EXISTS vector;"
        ),
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('embedding_dim', models.IntegerField(default=384)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'application_collection',
            },
        ),
        migrations.CreateModel(
            name='NodeEntry',
            fields=[
                ('node_id', models.AutoField(primary_key=True, serialize=False)),
                ('content', models.TextField()),
                ('embedding', pgvector.django.VectorField(dimensions=384)),
                ('source_file_uuid', models.CharField(max_length=255)),
                ('position', models.IntegerField(blank=True, null=True)),
                ('custom_metadata', models.JSONField(blank=True, default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='nodes', to='application.collection')),
            ],
            options={
                'db_table': 'application_nodeentry',
                'indexes': [
                    models.Index(fields=['source_file_uuid'], name='application_source__idx'),
                    models.Index(fields=['collection', 'source_file_uuid'], name='application_collect_idx'),
                ],
            },
        ),
    ]

