# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2018-08-17 02:12
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Cluster',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cluster_name', models.CharField(max_length=255, unique=True, verbose_name='集群名称')),
                ('cluster_type', models.CharField(max_length=255, verbose_name='集群类型')),
                ('cluster_desc', models.CharField(max_length=255, verbose_name='集群描述')),
                ('environment', models.CharField(max_length=255, verbose_name='环境')),
            ],
            options={
                'verbose_name': '集群',
                'verbose_name_plural': '集群',
                'permissions': (('scan_cluster', 'Can scan cluster info'),),
            },
        ),
        migrations.CreateModel(
            name='Database',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('instance', models.CharField(blank=True, max_length=255, null=True, unique=True, verbose_name='数据库实例名称')),
                ('db_type', models.CharField(blank=True, max_length=255, null=True, verbose_name='数据库类型')),
                ('cluster', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cmdb.Cluster', verbose_name='集群')),
            ],
            options={
                'verbose_name': '数据库实例',
                'verbose_name_plural': '数据库实例',
                'permissions': (('scan_database', 'Can scan database info'),),
            },
        ),
        migrations.CreateModel(
            name='DbSchema',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('schema', models.CharField(max_length=255, verbose_name='数据库名')),
                ('url', models.CharField(blank=True, max_length=255, null=True, verbose_name='数据库地址')),
                ('port', models.CharField(blank=True, max_length=255, null=True, verbose_name='端口')),
                ('user', models.CharField(blank=True, max_length=255, null=True, verbose_name='用户名')),
                ('password', models.CharField(blank=True, max_length=255, null=True, verbose_name='密码')),
                ('instance', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cmdb.Database', verbose_name='数据库实例')),
            ],
            options={
                'verbose_name': '数据库',
                'verbose_name_plural': '数据库',
                'permissions': (('scan_dbschema', 'Can scan dbschema info'),),
            },
        ),
        migrations.CreateModel(
            name='DomainName',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dns', models.CharField(max_length=255, verbose_name='域名地址')),
                ('domain_type', models.CharField(default='A', max_length=255, verbose_name='域名类型')),
                ('project_module_url', models.CharField(blank=True, max_length=255, null=True, verbose_name='服务访问地址')),
                ('environment', models.CharField(blank=True, max_length=255, null=True, verbose_name='环境')),
            ],
            options={
                'verbose_name': 'dns域名信息',
                'verbose_name_plural': 'dns域名信息',
                'permissions': (('scan_domainname', 'Can scan domainname'),),
            },
        ),
        migrations.CreateModel(
            name='Host',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('host_name', models.CharField(max_length=255, unique=True, verbose_name='主机DNS名称')),
                ('kernel', models.CharField(blank=True, max_length=255, null=True, verbose_name='系统内核')),
                ('osrelease', models.CharField(blank=True, max_length=255, null=True, verbose_name='操作系统版本')),
                ('os', models.CharField(blank=True, max_length=255, null=True, verbose_name='操作系统')),
                ('cpu_nums', models.CharField(blank=True, max_length=255, null=True, verbose_name='cpu核数')),
                ('memory', models.CharField(blank=True, max_length=255, null=True, verbose_name='内存大小')),
                ('environment', models.CharField(blank=True, max_length=255, null=True, verbose_name='环境')),
                ('host_usage', models.CharField(blank=True, choices=[('app', '应用'), ('db', '数据库'), ('mid', '中间件'), ('plaform', '平台')], max_length=255, null=True, verbose_name='主机用途')),
                ('host_type', models.CharField(blank=True, max_length=255, null=True, verbose_name='主机类型')),
                ('cluster', models.ManyToManyField(blank=True, null=True, related_query_name='host', to='cmdb.Cluster', verbose_name='集群')),
            ],
            options={
                'verbose_name': '主机',
                'verbose_name_plural': '主机',
                'permissions': (('scan_host', 'Can scan a host'),),
            },
        ),
        migrations.CreateModel(
            name='IpPool',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip_address', models.CharField(max_length=255, unique=True, verbose_name='ip地址')),
                ('gateway', models.CharField(blank=True, max_length=255, null=True, verbose_name='网关')),
                ('ip_segment', models.CharField(blank=True, max_length=255, null=True, verbose_name='网段')),
                ('ip_type', models.CharField(blank=True, max_length=255, null=True, verbose_name='IP地址类型')),
                ('host', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cmdb.Host', verbose_name='主机')),
            ],
            options={
                'verbose_name': 'ip地址信息',
                'verbose_name_plural': 'ip地址信息',
                'permissions': (('scan_ippool', 'Can scan ippool info'),),
            },
        ),
        migrations.CreateModel(
            name='MiddleWare',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mid_name', models.CharField(max_length=255, unique=True, verbose_name='名称')),
                ('mid_type', models.CharField(blank=True, max_length=255, null=True, verbose_name='中间件类型')),
                ('mid_description', models.CharField(blank=True, max_length=255, null=True, verbose_name='描述')),
                ('mid_version', models.CharField(blank=True, max_length=255, null=True, verbose_name='版本')),
            ],
            options={
                'verbose_name': '中间件',
                'verbose_name_plural': '中间件',
                'permissions': (('scan_middleware', 'Can scan middleware info'),),
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='名称')),
                ('real_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='汉字名称')),
                ('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='描述')),
                ('dev_leading', models.CharField(blank=True, max_length=255, null=True, verbose_name='开发负责人')),
                ('test_leading', models.CharField(blank=True, max_length=255, null=True, verbose_name='测试负责人')),
                ('proj_leading', models.CharField(blank=True, max_length=255, null=True, verbose_name='项目负责人')),
                ('ops_leading', models.CharField(blank=True, max_length=255, null=True, verbose_name='运维负责人')),
            ],
            options={
                'verbose_name': '项目',
                'verbose_name_plural': '项目',
                'permissions': (('scan_project', 'Can scan project info'),),
            },
        ),
        migrations.CreateModel(
            name='ProjectModule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('module_name', models.CharField(max_length=255, unique=True, verbose_name='模块名称')),
                ('module_desc', models.CharField(max_length=255, verbose_name='模块描述')),
                ('service_type', models.CharField(max_length=255, verbose_name='服务')),
                ('git_url', models.CharField(max_length=255, verbose_name='git地址')),
                ('cluster', models.ManyToManyField(blank=True, null=True, to='cmdb.Cluster', verbose_name='集群')),
                ('db_schema', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cmdb.DbSchema', verbose_name='数据库')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cmdb.Project', verbose_name='项目')),
            ],
            options={
                'verbose_name': '项目模块',
                'verbose_name_plural': '项目模块',
                'permissions': (('scan_projectmodule', 'Can scan projectmodule info'),),
            },
        ),
        migrations.AddField(
            model_name='domainname',
            name='ip',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cmdb.IpPool'),
        ),
        migrations.AddField(
            model_name='domainname',
            name='project_module',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cmdb.ProjectModule', verbose_name='服务名称'),
        ),
        migrations.AddField(
            model_name='database',
            name='host',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cmdb.Host', verbose_name='主机'),
        ),
    ]
