# Generated by Django 6.0.2 on 2026-02-08 18:31

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0024_add_usage_snapshot'),
    ]

    operations = [
        migrations.CreateModel(
            name='AgentLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tool_use_line_num', models.PositiveIntegerField()),
                ('tool_use_id', models.CharField(max_length=255)),
                ('agent_id', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='ToolResultLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tool_use_line_num', models.PositiveIntegerField()),
                ('tool_result_line_num', models.PositiveIntegerField()),
                ('tool_use_id', models.CharField(max_length=255)),
            ],
        ),
        migrations.RemoveIndex(
            model_name='sessionitemlink',
            name='idx_item_link_lookup',
        ),
        migrations.AddField(
            model_name='agentlink',
            name='session',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agent_links', to='core.session'),
        ),
        migrations.AddField(
            model_name='toolresultlink',
            name='session',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tool_result_links', to='core.session'),
        ),
        migrations.RemoveField(
            model_name='sessionitemlink',
            name='session',
        ),
        migrations.AddIndex(
            model_name='agentlink',
            index=models.Index(fields=['session', 'tool_use_id'], name='idx_agent_link_lookup'),
        ),
        migrations.AddIndex(
            model_name='toolresultlink',
            index=models.Index(fields=['session', 'tool_use_line_num', 'tool_use_id'], name='idx_tool_result_link_lookup'),
        ),
        migrations.DeleteModel(
            name='SessionItemLink',
        ),
    ]
