# Generated by Django 2.1.5 on 2019-03-08 15:21

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Host',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
                ('ip', models.GenericIPAddressField(unique=True)),
                ('port', models.SmallIntegerField(default=22)),
            ],
        ),
        migrations.CreateModel(
            name='Host2RemoteUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('host', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app01.Host')),
            ],
        ),
        migrations.CreateModel(
            name='HostGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, unique=True)),
                ('host_to_remote_user', models.ManyToManyField(blank=True, null=True, to='app01.Host2RemoteUser')),
            ],
        ),
        migrations.CreateModel(
            name='IDC',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='RemoteUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('login_type', models.SmallIntegerField(choices=[(1, 'ssh-key'), (0, 'ssh-password')], default=0)),
                ('username', models.CharField(max_length=32)),
                ('pwd', models.CharField(max_length=64)),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('username', models.CharField(max_length=32, unique=True)),
                ('pwd', models.CharField(max_length=64)),
                ('host_to_remote_user', models.ManyToManyField(blank=True, null=True, to='app01.Host2RemoteUser')),
                ('hostgroup', models.ManyToManyField(blank=True, null=True, to='app01.HostGroup')),
            ],
        ),
        migrations.AlterUniqueTogether(
            name='remoteuser',
            unique_together={('login_type', 'username', 'pwd')},
        ),
        migrations.AddField(
            model_name='host2remoteuser',
            name='remote_user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app01.RemoteUser'),
        ),
        migrations.AddField(
            model_name='host',
            name='idc',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app01.IDC'),
        ),
        migrations.AlterUniqueTogether(
            name='host2remoteuser',
            unique_together={('host', 'remote_user')},
        ),
    ]
