# Generated by Django 5.1.5 on 2025-03-31 14:03

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


class Migration(migrations.Migration):

    dependencies = [
        ('user_management', '0003_alter_feishucreator_handle'),
    ]

    operations = [
        migrations.CreateModel(
            name='KnowledgeBaseDocument',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('document_id', models.CharField(max_length=100, verbose_name='文档ID')),
                ('document_name', models.CharField(max_length=255, verbose_name='文档名称')),
                ('external_id', models.CharField(max_length=100, verbose_name='外部文档ID')),
                ('status', models.CharField(choices=[('active', '有效'), ('deleted', '已删除')], default='active', max_length=20, verbose_name='状态')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('knowledge_base', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='kb_documents', to='user_management.knowledgebase', verbose_name='知识库')),
            ],
            options={
                'verbose_name': '知识库文档',
                'verbose_name_plural': '知识库文档',
                'db_table': 'knowledge_base_documents',
                'indexes': [models.Index(fields=['knowledge_base', 'status'], name='knowledge_b_knowled_a4db1b_idx'), models.Index(fields=['document_id'], name='knowledge_b_documen_dab90f_idx'), models.Index(fields=['external_id'], name='knowledge_b_externa_b0060c_idx')],
                'unique_together': {('knowledge_base', 'document_id')},
            },
        ),
    ]
