# Generated by Django 5.1.1 on 2024-10-04 03:33

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


class Migration(migrations.Migration):

    dependencies = [
        ("currencies", "0003_alter_currency_decimal_places"),
    ]

    operations = [
        migrations.CreateModel(
            name="ExchangeRate",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "rate",
                    models.DecimalField(
                        decimal_places=30, max_digits=42, verbose_name="Exchange Rate"
                    ),
                ),
                ("date", models.DateTimeField(verbose_name="Date and Time")),
                (
                    "from_currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="from_exchange_rates",
                        to="currencies.currency",
                        verbose_name="From Currency",
                    ),
                ),
                (
                    "to_currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="to_exchange_rates",
                        to="currencies.currency",
                        verbose_name="To Currency",
                    ),
                ),
            ],
            options={
                "verbose_name": "Exchange Rate",
                "verbose_name_plural": "Exchange Rates",
                "unique_together": {("from_currency", "to_currency", "date")},
            },
        ),
    ]
