# -*- coding: utf-8 -*-
# Generated by Django 1.11.15.dev20180729042848 on 2020-04-13 06:07
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from future import standard_library
standard_library.install_aliases()
from builtins import *
from django.db import migrations, models
import django.db.models.deletion
import transhistory.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('transhistory', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(db_index=True, max_length=50)),
                ('last_name', models.CharField(db_index=True, max_length=50)),
            ],
            bases=(models.Model, transhistory.models.TransHistoryMixin),
        ),
        migrations.CreateModel(
            name='EmployeeHistory',
            fields=[
                ('vid', models.AutoField(primary_key=True, serialize=False)),
                ('identity_id', models.IntegerField(db_index=True)),
                ('first_name', models.CharField(db_index=True, max_length=50)),
                ('last_name', models.CharField(db_index=True, max_length=50)),
                ('primary_organization_id', models.IntegerField(blank=True, db_index=True, null=True)),
                ('cost_center_id', models.IntegerField(blank=True, db_index=True, null=True)),
                ('created_at_rev', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_employees_set', to='transhistory.Revision')),
                ('deleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deleted_employees_set', to='transhistory.Revision')),
                ('obsoleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='obsoleted_employees_set', to='transhistory.Revision')),
            ],
            options={
                'ordering': ('created_at_rev',),
            },
        ),
        migrations.CreateModel(
            name='EmployeeOrganizationsHistory',
            fields=[
                ('vid', models.AutoField(primary_key=True, serialize=False)),
                ('identity_id', models.IntegerField(db_index=True)),
                ('employee_id', models.IntegerField(db_index=True)),
                ('organization_id', models.IntegerField(db_index=True)),
                ('created_at_rev', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_employee_organizations_set', to='transhistory.Revision')),
                ('deleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deleted_employee_organizations_set', to='transhistory.Revision')),
                ('obsoleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='obsoleted_employee_organizations_set', to='transhistory.Revision')),
            ],
            options={
                'ordering': ('created_at_rev',),
            },
        ),
        migrations.CreateModel(
            name='Organization',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=50)),
                ('parent_organization', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='personnel.Organization')),
            ],
        ),
        migrations.CreateModel(
            name='OrganizationHistory',
            fields=[
                ('vid', models.AutoField(primary_key=True, serialize=False)),
                ('identity_id', models.IntegerField(db_index=True)),
                ('name', models.CharField(db_index=True, max_length=50)),
                ('parent_organization_id', models.IntegerField(db_index=True, null=True)),
                ('created_at_rev', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_organizations_set', to='transhistory.Revision')),
                ('deleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deleted_organizations_set', to='transhistory.Revision')),
                ('obsoleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='obsoleted_organizations_set', to='transhistory.Revision')),
            ],
            options={
                'ordering': ('created_at_rev',),
            },
        ),
        migrations.CreateModel(
            name='UserGroupsHistory',
            fields=[
                ('vid', models.AutoField(primary_key=True, serialize=False)),
                ('identity_id', models.IntegerField(db_index=True)),
                ('user_id', models.IntegerField(db_index=True)),
                ('group_id', models.IntegerField(db_index=True)),
                ('created_at_rev', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_user_groups_set', to='transhistory.Revision')),
                ('deleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deleted_user_groups_set', to='transhistory.Revision')),
                ('obsoleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='obsoleted_user_groups_set', to='transhistory.Revision')),
            ],
            options={
                'ordering': ('created_at_rev',),
            },
        ),
        migrations.CreateModel(
            name='UserHistory',
            fields=[
                ('vid', models.AutoField(primary_key=True, serialize=False)),
                ('identity_id', models.IntegerField(db_index=True)),
                ('username', models.CharField(db_index=True, max_length=50)),
                ('first_name', models.CharField(db_index=True, max_length=50)),
                ('last_name', models.CharField(db_index=True, max_length=50)),
                ('email', models.CharField(db_index=True, max_length=75)),
                ('password', models.CharField(max_length=128)),
                ('is_staff', models.BooleanField()),
                ('is_active', models.BooleanField()),
                ('is_superuser', models.BooleanField()),
                ('last_login', models.DateTimeField()),
                ('date_joined', models.DateTimeField()),
                ('created_at_rev', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_user_set', to='transhistory.Revision')),
                ('deleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deleted_users_set', to='transhistory.Revision')),
                ('obsoleted_at_rev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='obsoleted_users_set', to='transhistory.Revision')),
            ],
            options={
                'ordering': ('created_at_rev',),
            },
        ),
        migrations.AddField(
            model_name='employee',
            name='cost_center',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cost_center_employee_set', to='personnel.Organization'),
        ),
        migrations.AddField(
            model_name='employee',
            name='organizations',
            field=models.ManyToManyField(related_name='employee_set', to='personnel.Organization'),
        ),
        migrations.AddField(
            model_name='employee',
            name='primary_organization',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='primary_employee_set', to='personnel.Organization'),
        ),
        migrations.AlterUniqueTogether(
            name='userhistory',
            unique_together=set([('obsoleted_at_rev', 'identity_id'), ('created_at_rev', 'identity_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='usergroupshistory',
            unique_together=set([('obsoleted_at_rev', 'identity_id'), ('created_at_rev', 'identity_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='organizationhistory',
            unique_together=set([('obsoleted_at_rev', 'identity_id'), ('created_at_rev', 'identity_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='employeeorganizationshistory',
            unique_together=set([('obsoleted_at_rev', 'identity_id'), ('created_at_rev', 'identity_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='employeehistory',
            unique_together=set([('obsoleted_at_rev', 'identity_id'), ('created_at_rev', 'identity_id')]),
        ),
    ]
