# Generated by Django 5.2 on 2024-09-16 18:23

from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("lamindb", "0066_alter_artifact__feature_values_and_more"),
        ("wetlab", "0022_remove_experiment_experiment_type_and_more"),
    ]

    operations = [
        migrations.AddField(
            model_name="compoundtreatment",
            name="duration",
            field=models.DurationField(default=None, null=True),
        ),
        migrations.AddField(
            model_name="environmentaltreatment",
            name="duration",
            field=models.DurationField(default=None, null=True),
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactcombinationtreatment (artifact_id, combinationtreatment_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, combinationtreatment_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_combinationtreatment_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactcompound (artifact_id, compound_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, compound_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_compound_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactcompoundtreatment (artifact_id, compoundtreatment_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, compoundtreatment_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_compoundtreatment_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactenvironmentaltreatment (artifact_id, environmentaltreatment_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, environmentaltreatment_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_environmentaltreatment_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactexperiment (artifact_id, experiment_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, experiment_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_experiment_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactgenetictreatment (artifact_id, genetictreatment_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, genetictreatment_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_genetictreatment_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifacttreatmenttarget (artifact_id, treatmenttarget_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, treatmenttarget_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_treatmenttarget_artifacts;
            """
        ),
        migrations.RunSQL(
            f"""
            INSERT INTO wetlab_artifactwell (artifact_id, well_id, feature_id, created_by_id, created_at)
            SELECT artifact_id, well_id, NULL, {1}, CURRENT_TIMESTAMP
            FROM wetlab_well_artifacts;
            """
        ),
        migrations.RemoveField(
            model_name="combinationtreatment",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="combinationtreatment",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="combination_treatments",
                through="wetlab.ArtifactCombinationTreatment",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="compound",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="compound",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="compounds",
                through="wetlab.ArtifactCompound",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="compoundtreatment",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="compoundtreatment",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="compound_treatments",
                through="wetlab.ArtifactCompoundTreatment",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="environmentaltreatment",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="environmentaltreatment",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="environmental_treatments",
                through="wetlab.ArtifactEnvironmentalTreatment",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="experiment",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="experiment",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="experiments",
                through="wetlab.ArtifactExperiment",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="genetictreatment",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="genetictreatment",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="genetic_treatments",
                through="wetlab.ArtifactGeneticTreatment",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="treatmenttarget",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="treatmenttarget",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="treatment_targets",
                through="wetlab.ArtifactTreatmentTarget",
                to="lamindb.artifact",
            ),
        ),
        migrations.RemoveField(
            model_name="well",
            name="artifacts",
        ),
        migrations.AddField(
            model_name="well",
            name="artifacts",
            field=models.ManyToManyField(
                related_name="wells",
                through="wetlab.ArtifactWell",
                to="lamindb.artifact",
            ),
        ),
    ]
