# Generated by Django 5.2.10 on 2026-03-27 09:42

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("simulated_trading", "0014_recalculate_position_cost_basis"),
    ]

    operations = [
        migrations.CreateModel(
            name="LedgerMigrationMapModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "source_app",
                    models.CharField(
                        choices=[("account", "account app")],
                        default="account",
                        max_length=50,
                        verbose_name="来源应用",
                    ),
                ),
                (
                    "source_table",
                    models.CharField(
                        choices=[
                            ("portfolio", "PortfolioModel"),
                            ("position", "PositionModel (account)"),
                            ("transaction", "TransactionModel"),
                        ],
                        max_length=50,
                        verbose_name="来源表",
                    ),
                ),
                ("source_id", models.IntegerField(verbose_name="来源ID")),
                (
                    "target_table",
                    models.CharField(
                        choices=[
                            ("simulated_account", "SimulatedAccountModel"),
                            ("simulated_position", "PositionModel (simulated_trading)"),
                            ("simulated_trade", "SimulatedTradeModel"),
                        ],
                        max_length=50,
                        verbose_name="目标表",
                    ),
                ),
                ("target_id", models.IntegerField(verbose_name="目标ID")),
                ("migrated_at", models.DateTimeField(auto_now_add=True, verbose_name="迁移时间")),
                ("notes", models.CharField(blank=True, max_length=500, verbose_name="备注")),
            ],
            options={
                "verbose_name": "账本迁移映射",
                "verbose_name_plural": "账本迁移映射",
                "db_table": "ledger_migration_map",
                "indexes": [
                    models.Index(
                        fields=["source_app", "source_table", "source_id"],
                        name="ledger_migr_source__8ac14d_idx",
                    ),
                    models.Index(
                        fields=["target_table", "target_id"], name="ledger_migr_target__bc9a11_idx"
                    ),
                ],
                "unique_together": {("source_app", "source_table", "source_id")},
            },
        ),
    ]
