# Generated by Django 2.2.6 on 2019-10-25 06:05

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Asset',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('asset_type', models.CharField(choices=[('server', 'server'), ('networkdevice', 'network device'), ('storagedevice', 'storage device'), ('securitydevice', 'security device'), ('software', 'software')], default='server', max_length=64, verbose_name='Asset Type')),
                ('name', models.CharField(max_length=64, unique=True, verbose_name='Asset Name')),
                ('sn', models.CharField(max_length=128, unique=True, verbose_name='Asset Serial Number')),
                ('status', models.SmallIntegerField(choices=[(0, 'online'), (1, 'offline'), (2, 'unknown'), (3, 'faulted'), (4, 'spare')], default=0, verbose_name='Device Status')),
                ('manage_ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='Manage IP')),
                ('purchase_day', models.DateField(blank=True, null=True, verbose_name='Purchase Day')),
                ('expire_day', models.DateField(blank=True, null=True, verbose_name='Expire Day')),
                ('price', models.FloatField(blank=True, null=True, verbose_name='Price')),
                ('memo', models.TextField(blank=True, null=True, verbose_name='Memo')),
                ('c_time', models.DateTimeField(auto_now_add=True, verbose_name='Approved Date')),
                ('m_time', models.DateTimeField(auto_now=True, verbose_name='Updated Date')),
                ('admin', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='admin', to=settings.AUTH_USER_MODEL, verbose_name='Asset Manager')),
                ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_by', to=settings.AUTH_USER_MODEL, verbose_name='Approved By Whom')),
            ],
            options={
                'verbose_name': 'Asset Main Table',
                'verbose_name_plural': 'Asset Main Table',
                'ordering': ['-c_time'],
            },
        ),
        migrations.CreateModel(
            name='Contract',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sn', models.CharField(max_length=128, unique=True, verbose_name='Contract Number')),
                ('name', models.CharField(max_length=64, verbose_name='contract Name')),
                ('memo', models.TextField(blank=True, null=True, verbose_name='Memo')),
                ('price', models.IntegerField(verbose_name='Contract Price')),
                ('detail', models.TextField(blank=True, null=True, verbose_name='Contract Detail')),
                ('start_day', models.DateField(blank=True, null=True, verbose_name='Start Date')),
                ('end_day', models.DateField(blank=True, null=True, verbose_name='End Date')),
                ('license_num', models.IntegerField(blank=True, null=True, verbose_name='License Amount')),
                ('c_day', models.DateField(auto_now_add=True, verbose_name='Created Date')),
                ('m_day', models.DateField(auto_now=True, verbose_name='Modified Date')),
            ],
            options={
                'verbose_name': 'Contract',
                'verbose_name_plural': 'Contract',
            },
        ),
        migrations.CreateModel(
            name='IDC',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True, verbose_name='IDC Name')),
                ('memo', models.CharField(blank=True, max_length=128, null=True, verbose_name='Memo')),
            ],
            options={
                'verbose_name': 'IDC',
                'verbose_name_plural': 'IDC',
            },
        ),
        migrations.CreateModel(
            name='Manufacturer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True, verbose_name='Manufacturer Name')),
                ('telephone', models.CharField(blank=True, max_length=30, null=True, verbose_name='Support Telephone')),
                ('memo', models.CharField(blank=True, max_length=128, null=True, verbose_name='Memo')),
            ],
            options={
                'verbose_name': 'Manufacturer',
                'verbose_name_plural': 'Manufacturer',
            },
        ),
        migrations.CreateModel(
            name='NewAssetApprovalZone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sn', models.CharField(max_length=128, unique=True, verbose_name='Asset SN Number')),
                ('asset_type', models.CharField(blank=True, choices=[('server', 'Server'), ('networkdevice', 'Network Device'), ('storagedevice', 'Storage Device'), ('securitydevice', 'Security Device'), ('software', 'Software')], default='server', max_length=64, null=True, verbose_name='Asset Type')),
                ('manufacturer', models.CharField(blank=True, max_length=64, null=True, verbose_name='Manufacturer')),
                ('model', models.CharField(blank=True, max_length=128, null=True, verbose_name='Model')),
                ('ram_size', models.PositiveIntegerField(blank=True, null=True, verbose_name='Capacity')),
                ('cpu_model', models.CharField(blank=True, max_length=128, null=True, verbose_name='CPU Model')),
                ('cpu_count', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='CPU Amount')),
                ('cpu_core_count', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='CPU Core Amount')),
                ('os_distribution', models.CharField(blank=True, max_length=64, null=True, verbose_name='Distribution')),
                ('os_type', models.CharField(blank=True, max_length=64, null=True, verbose_name='OS Type')),
                ('os_release', models.CharField(blank=True, max_length=64, null=True, verbose_name='OS Release')),
                ('data', models.TextField(verbose_name='Asset Data')),
                ('c_time', models.DateTimeField(auto_now_add=True, verbose_name='Report Date')),
                ('m_time', models.DateTimeField(auto_now=True, verbose_name='Data Update Date')),
                ('approved', models.BooleanField(default=False, verbose_name='Approval')),
            ],
            options={
                'verbose_name': 'New Asset Approval Zone',
                'verbose_name_plural': 'New Asset Approval Zone',
                'ordering': ['-c_time'],
            },
        ),
        migrations.CreateModel(
            name='Software',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sub_asset_type', models.SmallIntegerField(blank=True, choices=[(0, 'OS'), (1, 'Office/Development'), (2, 'Business')], default=0, null=True, verbose_name='Software Type')),
                ('license_num', models.IntegerField(default=1, verbose_name='License Amount')),
                ('version', models.CharField(help_text='i.e. RedHat release 7 (Final)', max_length=64, unique=True, verbose_name='Software/OS Version')),
            ],
            options={
                'verbose_name': 'Software/OS',
                'verbose_name_plural': 'Software/OS',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, unique=True, verbose_name='Tag Name')),
                ('c_day', models.DateField(auto_now_add=True, verbose_name='Created Date')),
            ],
            options={
                'verbose_name': 'Tag',
                'verbose_name_plural': 'Tag',
            },
        ),
        migrations.CreateModel(
            name='StorageDevice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sub_asset_type', models.SmallIntegerField(choices=[(0, 'RIAD'), (1, 'Network Storage'), (2, 'Tape Library'), (4, 'Magnet Tape Unit')], default=0, verbose_name='Storage Device Type')),
                ('model', models.CharField(default='Unknown Model', max_length=128, verbose_name='Storage Device Model')),
                ('asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'Storage Device',
                'verbose_name_plural': 'Storage Device',
            },
        ),
        migrations.CreateModel(
            name='Server',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sub_asset_type_choice', models.SmallIntegerField(choices=[(0, 'PC Server'), (1, 'Blade Computer'), (2, 'Small Device')], default=0, verbose_name='Server Type')),
                ('created_by', models.CharField(choices=[('auto', 'Record Automatically'), ('manually', 'Record Manually')], default='auto', max_length=32, verbose_name='Record Mode')),
                ('model', models.CharField(blank=True, max_length=128, null=True, verbose_name='Server Model')),
                ('raid_type', models.CharField(blank=True, max_length=512, null=True, verbose_name='Raid Type')),
                ('os_type', models.CharField(blank=True, max_length=64, null=True, verbose_name='OS Type')),
                ('os_distribution', models.CharField(blank=True, max_length=64, null=True, verbose_name='Distribution')),
                ('os_release', models.CharField(blank=True, max_length=64, null=True, verbose_name='OS Release')),
                ('asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
                ('hosted_on', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='hosted_on_server', to='assets.Server', verbose_name='Hosted Machine')),
            ],
            options={
                'verbose_name': 'Server',
                'verbose_name_plural': 'Server',
            },
        ),
        migrations.CreateModel(
            name='SecurityDevice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sub_asset_type', models.SmallIntegerField(choices=[(0, 'Firewall'), (1, 'Invade Device Detection'), (2, 'Internet Gateway'), (4, 'DevOps Audit System')], default=0, verbose_name='Security Asset Type')),
                ('model', models.CharField(default='Unknown Model', max_length=128, verbose_name='Security Device Model')),
                ('asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'Security Device',
                'verbose_name_plural': 'Security Device',
            },
        ),
        migrations.CreateModel(
            name='NetworkDevice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sub_asset_type', models.SmallIntegerField(choices=[(0, 'Router'), (1, 'Switcher'), (2, 'LB'), (4, 'VPN Device')], default=0, verbose_name='Storage Device Type')),
                ('vlan_ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='VLanIP')),
                ('intranet_ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='Intranet IP')),
                ('model', models.CharField(default='Unknown Model', max_length=128, verbose_name='Network Storage Device')),
                ('firmware', models.CharField(blank=True, max_length=128, null=True, verbose_name='Device Firmware Model')),
                ('port_num', models.SmallIntegerField(blank=True, null=True, verbose_name='The Number Of Port')),
                ('device_detail', models.TextField(blank=True, null=True, verbose_name='Device Detail')),
                ('asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'Network Device',
                'verbose_name_plural': 'Network Device',
            },
        ),
        migrations.CreateModel(
            name='EventLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='Event Name')),
                ('event_type', models.SmallIntegerField(choices=[(0, 'Other'), (1, 'Hardware Update'), (2, 'Accessories Update'), (3, 'Device Offline'), (4, 'Device Online'), (5, 'Maintainese'), (6, 'Business Online/Update')], default=4, verbose_name='Event Type')),
                ('component', models.CharField(blank=True, max_length=256, null=True, verbose_name='Event Component')),
                ('detail', models.TextField(verbose_name='Event Detail')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='Event Time')),
                ('memo', models.TextField(blank=True, null=True, verbose_name='Memo')),
                ('asset', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.Asset')),
                ('new_asset', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.NewAssetApprovalZone')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='事件执行人')),
            ],
            options={
                'verbose_name': 'Event Log',
                'verbose_name_plural': 'Event Log',
            },
        ),
        migrations.CreateModel(
            name='CPU',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cpu_model', models.CharField(blank=True, max_length=128, null=True, verbose_name='CPU Model')),
                ('cpu_count', models.PositiveSmallIntegerField(default=1, verbose_name='Physical CPU Amount')),
                ('cpu_core_count', models.PositiveSmallIntegerField(default=1, verbose_name='CPU Core Number')),
                ('asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'CPU',
                'verbose_name_plural': 'CPU',
            },
        ),
        migrations.CreateModel(
            name='BusinessUnit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True, verbose_name='Business Unit')),
                ('memo', models.CharField(blank=True, max_length=64, null=True, verbose_name='Memo')),
                ('parent_unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='parent_level', to='assets.BusinessUnit')),
            ],
            options={
                'verbose_name': 'Business Unit',
                'verbose_name_plural': 'Business Unit',
            },
        ),
        migrations.AddField(
            model_name='asset',
            name='business_unit',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.BusinessUnit', verbose_name='Subordinated Business'),
        ),
        migrations.AddField(
            model_name='asset',
            name='contract',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.Contract', verbose_name='Contract'),
        ),
        migrations.AddField(
            model_name='asset',
            name='idc',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.IDC', verbose_name='Machine Room'),
        ),
        migrations.AddField(
            model_name='asset',
            name='manufacturer',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.Manufacturer', verbose_name='Manufacturer'),
        ),
        migrations.AddField(
            model_name='asset',
            name='tags',
            field=models.ManyToManyField(blank=True, to='assets.Tag', verbose_name='Tag'),
        ),
        migrations.CreateModel(
            name='RAM',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sn', models.CharField(blank=True, max_length=128, null=True, verbose_name='SN Number')),
                ('model', models.CharField(blank=True, max_length=128, null=True, verbose_name='RAM Model')),
                ('manufacturer', models.CharField(blank=True, max_length=128, null=True, verbose_name='RAM Manufacturer')),
                ('slot', models.CharField(max_length=64, verbose_name='Slot')),
                ('capacity', models.IntegerField(blank=True, null=True, verbose_name='RAM Size(GB)')),
                ('asset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'RAM',
                'verbose_name_plural': 'RAM',
                'unique_together': {('asset', 'slot')},
            },
        ),
        migrations.CreateModel(
            name='NIC',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=64, null=True, verbose_name='NIC Name')),
                ('model', models.CharField(max_length=128, verbose_name='NIC Model')),
                ('mac', models.CharField(max_length=64, verbose_name='MAC')),
                ('ip_address', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP')),
                ('net_mask', models.CharField(blank=True, max_length=64, null=True, verbose_name='Netmask')),
                ('bonding', models.CharField(blank=True, max_length=64, null=True, verbose_name='Bound Address')),
                ('asset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'NIC',
                'verbose_name_plural': 'NIC',
                'unique_together': {('asset', 'model', 'mac')},
            },
        ),
        migrations.CreateModel(
            name='Disk',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sn', models.CharField(max_length=128, verbose_name='Disk SN Number')),
                ('slot', models.CharField(blank=True, max_length=64, null=True, verbose_name='Slot')),
                ('model', models.CharField(blank=True, max_length=128, null=True, verbose_name='Disk Model')),
                ('manufacturer', models.CharField(blank=True, max_length=128, null=True, verbose_name='Disk Manufacturer')),
                ('capacity', models.FloatField(blank=True, null=True, verbose_name='Capacity')),
                ('interface_type', models.CharField(choices=[('SATA', 'SATA'), ('SCSI', 'SCSI'), ('SSD', 'SSD'), ('unknown', 'unknown')], default='unknown', max_length=16, verbose_name='Interface Type')),
                ('asset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assets.Asset')),
            ],
            options={
                'verbose_name': 'Disk',
                'verbose_name_plural': 'Disk',
                'unique_together': {('asset', 'sn')},
            },
        ),
    ]
