# Generated by Django 4.2.1 on 2023-07-04 12:03

import django.db.models.deletion
import lnschema_core.ids
import lnschema_core.users
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("lnschema_core", "0007_feature_synonyms_featureset_field_and_more"),
        (
            "lnschema_bionty",
            "0006_alter_biontysource_options_alter_cellline_options_and_more",
        ),
        ("wetlab", "0003_alter_biosample_created_by_and_more"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="treatment",
            name="target_genes",
        ),
        migrations.CreateModel(
            name="TreatmentTarget",
            fields=[
                (
                    "id",
                    models.CharField(
                        default=lnschema_core.ids.base62_8,
                        max_length=8,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("name", models.CharField(db_index=True, default=None, max_length=60)),
                ("description", models.TextField(default=None, null=True)),
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("updated_at", models.DateTimeField(auto_now=True, db_index=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        default=lnschema_core.users.current_user_id,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="created_genetic_perturbations",
                        to="lnschema_core.user",
                    ),
                ),
                (
                    "files",
                    models.ManyToManyField(
                        related_name="genetic_perturbations",
                        to="lnschema_core.artifact",
                    ),
                ),
                (
                    "genes",
                    models.ManyToManyField(related_name="treatment_targets", to="lnschema_bionty.gene"),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AlterField(
            model_name="treatment",
            name="target",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="treatments",
                to="wetlab.treatmenttarget",
            ),
        ),
    ]
