# Generated by Django 4.2.11 on 2024-04-27 09:14

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


class Migration(migrations.Migration):

    dependencies = [
        ('endoreg_db', '0028_alter_unit_abbreviation'),
    ]

    operations = [
        migrations.CreateModel(
            name='MedicationIntakeTime',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('repeats', models.CharField(default='daily', max_length=20)),
                ('time', models.TimeField()),
                ('unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit')),
            ],
        ),
        migrations.RemoveField(
            model_name='patientmedication',
            name='medication',
        ),
        migrations.RemoveField(
            model_name='patientmedication',
            name='name',
        ),
        migrations.RemoveField(
            model_name='patientmedication',
            name='name_de',
        ),
        migrations.RemoveField(
            model_name='patientmedication',
            name='name_en',
        ),
        migrations.AddField(
            model_name='medication',
            name='adapt_to_liver_function',
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name='medication',
            name='adapt_to_renal_function',
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name='patientlabvalue',
            name='normal_range',
            field=models.JSONField(default={}),
        ),
        migrations.AddField(
            model_name='patientmedication',
            name='patient',
            field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.patient'),
            preserve_default=False,
        ),
        migrations.CreateModel(
            name='MedicationSchedule',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('intake_times', models.ManyToManyField(to='endoreg_db.medicationintaketime')),
                ('medication', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.medication')),
                ('unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit')),
            ],
        ),
        migrations.AddField(
            model_name='patientmedication',
            name='medication_schedules',
            field=models.ManyToManyField(to='endoreg_db.medicationschedule'),
        ),
    ]
