# Generated by Django 5.2.1 on 2025-05-13 10:25
from __future__ import annotations

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


class Migration(migrations.Migration):

    dependencies = [
        ("datasets", "0020_remove_remote_datasets"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="dataset",
            name="is_default_version",
        ),
        migrations.RemoveField(
            model_name="dataset",
            name="version",
        ),
        migrations.AddField(
            model_name="dataset",
            name="default_version",
            field=models.CharField(default="v1", verbose_name="Default version"),
        ),
        migrations.CreateModel(
            name="DatasetVersion",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("version", models.CharField(default="v1", max_length=3)),
                (
                    "lifecycle_status",
                    models.CharField(
                        choices=[("E", "experimental"), ("S", "stable")], default="E"
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="versions",
                        to="datasets.dataset",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="datasettable",
            name="dataset_versions",
            field=models.ManyToManyField(related_name="tables", to="datasets.datasetversion"),
        ),
        migrations.AlterUniqueTogether(
            name="datasettable",
            unique_together={("dataset", "name", "version")},
        ),
        migrations.AlterField(
            model_name="datasettable",
            name="db_table",
            field=models.CharField(max_length=100, unique=True),
        ),
    ]
