# Generated by Django 2.2.12 on 2020-06-16 09:03

from django.conf import settings
from django.db import migrations, models
import django.utils.timezone
import simple_history.models
import varda.validators


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('varda', '0023_historicalpidempipoissaolo_pidempipoissaolo'),
    ]

    operations = [
        migrations.DeleteModel(
            name='Taydennyskoulutus',
        ),
        migrations.CreateModel(
            name='Taydennyskoulutus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nimi', models.CharField(max_length=120)),
                ('suoritus_pvm', models.DateField(validators=[varda.validators.validate_taydennyskoulutus_suoritus_pvm])),
                ('koulutuspaivia', models.DecimalField(decimal_places=1, max_digits=4, validators=[varda.validators.create_validate_decimal_steps('0.5')])),
                ('lahdejarjestelma', models.CharField(max_length=2, validators=[varda.validators.validate_lahdejarjestelma_koodi])),
                ('tunniste', models.CharField(blank=True, max_length=120, null=True, validators=[varda.validators.validate_tunniste])),
                ('luonti_pvm', models.DateTimeField(auto_now_add=True)),
                ('muutos_pvm', models.DateTimeField(auto_now=True)),
                ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='taydennyskoulutukset', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'taydennyskoulutukset',
            },
        ),
        migrations.CreateModel(
            name='TaydennyskoulutusTyontekija',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tehtavanimike_koodi', models.CharField(max_length=20, validators=[varda.validators.validate_tehtavanimike_koodi])),
                ('luonti_pvm', models.DateTimeField(auto_now_add=True)),
                ('muutos_pvm', models.DateTimeField(auto_now=True)),
                ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='taydennyskoulutukset_tyontekijat', to=settings.AUTH_USER_MODEL)),
                ('taydennyskoulutus', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='taydennyskoulutukset_tyontekijat', to='varda.Taydennyskoulutus')),
                ('tyontekija', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='taydennyskoulutukset_tyontekijat', to='varda.Tyontekija')),
            ],
            options={
                'verbose_name_plural': 'taydennyskoulutukset tyontekijat',
            },
        ),
        migrations.AddField(
            model_name='taydennyskoulutus',
            name='tyontekijat',
            field=models.ManyToManyField(related_name='taydennyskoulutukset', through='varda.TaydennyskoulutusTyontekija', to='varda.Tyontekija'),
        ),
        migrations.CreateModel(
            name='HistoricalTaydennyskoulutusTyontekija',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('tehtavanimike_koodi', models.CharField(max_length=20, validators=[varda.validators.validate_tehtavanimike_koodi])),
                ('luonti_pvm', models.DateTimeField(blank=True, editable=False)),
                ('muutos_pvm', models.DateTimeField(blank=True, editable=False)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('changed_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('taydennyskoulutus', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='varda.Taydennyskoulutus')),
                ('tyontekija', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='varda.Tyontekija')),
            ],
            options={
                'verbose_name': 'historical taydennyskoulutus tyontekija',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalTaydennyskoulutus',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('nimi', models.CharField(max_length=120)),
                ('suoritus_pvm', models.DateField(validators=[varda.validators.validate_taydennyskoulutus_suoritus_pvm])),
                ('koulutuspaivia', models.DecimalField(decimal_places=1, max_digits=4, validators=[varda.validators.create_validate_decimal_steps('0.5')])),
                ('lahdejarjestelma', models.CharField(max_length=2, validators=[varda.validators.validate_lahdejarjestelma_koodi])),
                ('tunniste', models.CharField(blank=True, max_length=120, null=True, validators=[varda.validators.validate_tunniste])),
                ('luonti_pvm', models.DateTimeField(blank=True, editable=False)),
                ('muutos_pvm', models.DateTimeField(blank=True, editable=False)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('changed_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical taydennyskoulutus',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
