# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2018-03-21 17:45 from __future__ import unicode_literals import datetime from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion import macaddress.fields import machines.models # Imported from machines.migrations.0063_auto_20171020_0040 ########################################################### def new_default_soa(): return SOA.objects.get_or_create(name="SOA to edit", mail="postmaser@example.com")[0].pk class Migration(migrations.Migration): replaces = [('machines', '0001_initial'), ('machines', '0002_auto_20160703_1444'), ('machines', '0003_auto_20160703_1450'), ('machines', '0004_auto_20160703_1451'), ('machines', '0005_auto_20160703_1523'), ('machines', '0006_auto_20160703_1813'), ('machines', '0007_auto_20160703_1816'), ('machines', '0008_remove_interface_ipv6'), ('machines', '0009_auto_20160703_2358'), ('machines', '0010_auto_20160704_0104'), ('machines', '0011_auto_20160704_0105'), ('machines', '0012_auto_20160704_0118'), ('machines', '0013_auto_20160705_1014'), ('machines', '0014_auto_20160706_1220'), ('machines', '0015_auto_20160707_0105'), ('machines', '0016_auto_20160708_1633'), ('machines', '0017_auto_20160708_1645'), ('machines', '0018_auto_20160708_1813'), ('machines', '0019_auto_20160718_1141'), ('machines', '0020_auto_20160718_1849'), ('machines', '0021_auto_20161006_1943'), ('machines', '0022_auto_20161011_1829'), ('machines', '0023_iplist_ip_type'), ('machines', '0024_machinetype_need_infra'), ('machines', '0025_auto_20161023_0038'), ('machines', '0026_auto_20161026_1348'), ('machines', '0027_alias'), ('machines', '0028_iptype_domaine_ip'), ('machines', '0029_iptype_domaine_range'), ('machines', '0030_auto_20161118_1730'), ('machines', '0031_auto_20161119_1709'), ('machines', '0032_auto_20161119_1850'), ('machines', '0033_extension_need_infra'), ('machines', '0034_iplist_need_infra'), ('machines', '0035_auto_20161224_1201'), ('machines', '0036_auto_20161224_1204'), ('machines', '0037_domain_cname'), ('machines', '0038_auto_20161224_1721'), ('machines', '0039_auto_20161224_1732'), ('machines', '0040_remove_interface_dns'), ('machines', '0041_remove_ns_interface'), ('machines', '0042_ns_ns'), ('machines', '0043_auto_20170721_0350'), ('machines', '0044_auto_20170808_0233'), ('machines', '0045_auto_20170808_0348'), ('machines', '0046_auto_20170808_1423'), ('machines', '0047_auto_20170809_0606'), ('machines', '0048_auto_20170823_2315'), ('machines', '0049_vlan'), ('machines', '0050_auto_20170826_0022'), ('machines', '0051_iptype_vlan'), ('machines', '0052_auto_20170828_2322'), ('machines', '0053_text'), ('machines', '0054_text_zone'), ('machines', '0055_nas'), ('machines', '0056_nas_port_access_mode'), ('machines', '0057_nas_autocapture_mac'), ('machines', '0058_auto_20171002_0350'), ('machines', '0059_iptype_prefix_v6'), ('machines', '0060_iptype_ouverture_ports'), ('machines', '0061_auto_20171015_2033'), ('machines', '0062_extension_origin_v6'), ('machines', '0063_auto_20171020_0040'), ('machines', '0064_auto_20171115_0253'), ('machines', '0065_auto_20171115_1514'), ('machines', '0066_srv'), ('machines', '0067_auto_20171116_0152'), ('machines', '0068_auto_20171116_0252'), ('machines', '0069_auto_20171116_0822'), ('machines', '0070_auto_20171231_1947'), ('machines', '0071_auto_20171231_2100'), ('machines', '0072_auto_20180108_1822'), ('machines', '0073_auto_20180128_2203'), ('machines', '0074_auto_20180129_0352'), ('machines', '0075_auto_20180130_0052'), ('machines', '0076_auto_20180130_1623')] initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Machine', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), ('name', models.CharField(blank=True, help_text='Optionnel', max_length=255, null=True)), ('active', models.BooleanField(default=True)), ], ), migrations.CreateModel( name='MachineType', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('type', models.CharField(max_length=255)), ], ), migrations.CreateModel( name='Interface', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('ipv6', models.GenericIPAddressField(protocol='IPv6')), ('mac_address', macaddress.fields.MACAddressField(integer=True)), ('details', models.CharField(max_length=255)), ('name', models.CharField(blank=True, max_length=255, unique=True)), ], ), migrations.CreateModel( name='IpList', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('ipv4', models.GenericIPAddressField(protocol='IPv4', unique=True)), ('ip_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.IpType')), ], ), migrations.AddField( model_name='interface', name='ipv4', field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'), ), migrations.AddField( model_name='interface', name='machine', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Machine'), ), migrations.AlterField( model_name='interface', name='mac_address', field=macaddress.fields.MACAddressField(integer=True, unique=True), ), migrations.RenameField( model_name='interface', old_name='name', new_name='dns', ), migrations.AlterField( model_name='interface', name='details', field=models.CharField(blank=True, max_length=255), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(max_length=255, unique=True), ), migrations.RemoveField( model_name='interface', name='ipv6', ), migrations.AlterField( model_name='interface', name='mac_address', field=macaddress.fields.MACAddressField(integer=False, max_length=17, unique=True), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text='Obligatoire et unique', max_length=255, unique=True), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text='Obligatoire et unique, doit se terminer en .rez et ne pas comporter de points', max_length=255, unique=True), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points", max_length=255, unique=True), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .example et ne pas comporter d'autres points", max_length=255, unique=True), ), migrations.CreateModel( name='Extension', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ], ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points", max_length=255, unique=True), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points", max_length=255, unique=True), ), migrations.AddField( model_name='interface', name='type', field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='machines.MachineType'), preserve_default=False, ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(max_length=255, unique=True), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text="Obligatoire et unique, doit se terminer par exemple en .rez et ne pas comporter d'autres points", max_length=255, unique=True), ), migrations.CreateModel( name='IpType', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('type', models.CharField(max_length=255)), ('need_infra', models.BooleanField(default=False)), ('extension', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')), ('domaine_ip', models.GenericIPAddressField(protocol='IPv4')), ('domaine_range', models.IntegerField(validators=[django.core.validators.MinValueValidator(16), django.core.validators.MaxValueValidator(32)])), ], ), migrations.AddField( model_name='machinetype', name='ip_type', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpType'), ), migrations.AlterField( model_name='interface', name='dns', field=models.CharField(help_text='Obligatoire et unique, ne doit pas comporter de points', max_length=255, unique=True), ), migrations.CreateModel( name='Alias', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('alias', models.CharField(help_text='Obligatoire et unique, ne doit pas comporter de points', max_length=255)), ('interface_parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Interface')), ('extension', models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')), ], ), migrations.AlterUniqueTogether( name='alias', unique_together=set([('alias', 'extension')]), ), migrations.CreateModel( name='Mx', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('priority', models.PositiveIntegerField(unique=True)), ('name', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='machines.Alias')), ('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')), ], ), migrations.CreateModel( name='Ns', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')), ], ), migrations.AddField( model_name='extension', name='origin', field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'), ), migrations.AlterField( model_name='extension', name='name', field=models.CharField(max_length=255, unique=True), ), migrations.AddField( model_name='extension', name='need_infra', field=models.BooleanField(default=False), ), migrations.RenameModel( old_name='Alias', new_name='Domain', ), migrations.RenameField( model_name='domain', old_name='alias', new_name='name', ), migrations.AlterField( model_name='domain', name='interface_parent', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Interface'), ), migrations.AddField( model_name='domain', name='cname', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='related_domain', to='machines.Domain'), ), migrations.AlterField( model_name='domain', name='interface_parent', field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Interface'), ), migrations.AlterUniqueTogether( name='domain', unique_together=set([('name', 'extension')]), ), migrations.RemoveField( model_name='interface', name='dns', ), migrations.AddField( model_name='ns', name='ns', field=models.OneToOneField(default=1, on_delete=django.db.models.deletion.PROTECT, to='machines.Domain'), preserve_default=False, ), migrations.CreateModel( name='Service', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('service_type', models.CharField(blank=True, max_length=255, unique=True)), ('time_regen', models.DurationField()), ], ), migrations.CreateModel( name='Service_link', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('last_regen', models.DateTimeField(auto_now_add=True)), ('asked_regen', models.BooleanField(default=False)), ('server', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Interface')), ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Service')), ], ), migrations.AddField( model_name='service', name='servers', field=models.ManyToManyField(through='machines.Service_link', to='machines.Interface'), ), migrations.RemoveField( model_name='service', name='time_regen', ), migrations.AddField( model_name='service', name='min_time_regen', field=models.DurationField(default=datetime.timedelta(0, 60), help_text='Temps minimal avant nouvelle génération du service'), ), migrations.AddField( model_name='service', name='regular_time_regen', field=models.DurationField(default=datetime.timedelta(0, 3600), help_text='Temps maximal avant nouvelle génération du service'), ), migrations.CreateModel( name='Vlan', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('vlan_id', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(4095)])), ('name', models.CharField(max_length=256)), ('comment', models.CharField(blank=True, max_length=256)), ], ), migrations.AddField( model_name='iptype', name='vlan', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.Vlan'), ), migrations.RenameField( model_name='iptype', old_name='domaine_ip', new_name='domaine_ip_start', ), migrations.RemoveField( model_name='iptype', name='domaine_range', ), migrations.AddField( model_name='iptype', name='domaine_ip_stop', field=models.GenericIPAddressField(default='255.255.254.254', protocol='IPv4'), preserve_default=False, ), migrations.CreateModel( name='Txt', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('field1', models.CharField(max_length=255)), ('field2', models.TextField(max_length=2047)), ('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')), ], ), migrations.CreateModel( name='Nas', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255, unique=True)), ('machine_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='machinetype_on_nas', to='machines.MachineType')), ('nas_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='nas_type', to='machines.MachineType')), ('port_access_mode', models.CharField(choices=[('802.1X', '802.1X'), ('Mac-address', 'Mac-address')], default='802.1X', max_length=32)), ('autocapture_mac', models.BooleanField(default=False)), ], ), migrations.CreateModel( name='OuverturePort', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('begin', models.IntegerField()), ('end', models.IntegerField()), ('protocole', models.CharField(choices=[('T', 'TCP'), ('U', 'UDP')], default='T', max_length=1)), ('io', models.CharField(choices=[('I', 'IN'), ('O', 'OUT')], default='O', max_length=1)), ], ), migrations.CreateModel( name='OuverturePortList', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(help_text='Nom de la configuration des ports.', max_length=255)), ], ), migrations.AddField( model_name='ouvertureport', name='port_list', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.OuverturePortList'), ), migrations.AddField( model_name='interface', name='port_lists', field=models.ManyToManyField(blank=True, to='machines.OuverturePortList'), ), migrations.AddField( model_name='iptype', name='prefix_v6', field=models.GenericIPAddressField(blank=True, null=True, protocol='IPv6'), ), migrations.AddField( model_name='iptype', name='ouverture_ports', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.OuverturePortList'), ), migrations.AlterField( model_name='ouvertureport', name='begin', field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(65535)]), ), migrations.AlterField( model_name='ouvertureport', name='end', field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(65535)]), ), migrations.AddField( model_name='extension', name='origin_v6', field=models.GenericIPAddressField(blank=True, null=True, protocol='IPv6'), ), migrations.CreateModel( name='SOA', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('mail', models.EmailField(help_text='Email du contact pour la zone', max_length=254)), ('refresh', models.PositiveIntegerField(default=86400, help_text='Secondes avant que les DNS secondaires doivent demander le serial du DNS primaire pour détecter une modification')), ('retry', models.PositiveIntegerField(default=7200, help_text='Secondes avant que les DNS secondaires fassent une nouvelle demande de serial en cas de timeout du DNS primaire')), ('expire', models.PositiveIntegerField(default=3600000, help_text='Secondes après lesquelles les DNS secondaires arrêtent de de répondre aux requêtes en cas de timeout du DNS primaire')), ('ttl', models.PositiveIntegerField(default=172800, help_text='Time To Live')), ], ), migrations.AddField( model_name='extension', name='soa', field=models.ForeignKey(default=new_default_soa, on_delete=django.db.models.deletion.CASCADE, to='machines.SOA'), ), migrations.CreateModel( name='Srv', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('service', models.CharField(max_length=31)), ('protocole', models.CharField(choices=[('TCP', 'TCP'), ('UDP', 'UDP')], default='TCP', max_length=3)), ('ttl', models.PositiveIntegerField(default=172800, help_text='Time To Live')), ('priority', models.PositiveIntegerField(default=0, help_text="La priorité du serveur cible (valeur entière non négative, plus elle est faible, plus ce serveur sera utilisé s'il est disponible)", validators=[django.core.validators.MaxValueValidator(65535)])), ('weight', models.PositiveIntegerField(default=0, help_text='Poids relatif pour les enregistrements de même priorité (valeur entière de 0 à 65535)', validators=[django.core.validators.MaxValueValidator(65535)])), ('port', models.PositiveIntegerField(help_text='Port (tcp/udp)', validators=[django.core.validators.MaxValueValidator(65535)])), ('extension', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')), ('target', models.ForeignKey(help_text='Serveur cible', on_delete=django.db.models.deletion.PROTECT, to='machines.Domain')), ], ), migrations.AlterField( model_name='extension', name='name', field=models.CharField(help_text='Nom de la zone, doit commencer par un point (.example.org)', max_length=255, unique=True), ), migrations.AlterField( model_name='extension', name='origin', field=models.OneToOneField(blank=True, help_text='Enregistrement A associé à la zone', null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'), ), migrations.AlterField( model_name='extension', name='origin_v6', field=models.GenericIPAddressField(blank=True, help_text='Enregistremen AAAA associé à la zone', null=True, protocol='IPv6'), ), migrations.AlterField( model_name='extension', name='origin_v6', field=models.GenericIPAddressField(blank=True, help_text='Enregistrement AAAA associé à la zone', null=True, protocol='IPv6'), ), migrations.AlterModelOptions( name='domain', options={'permissions': (('view_domain', 'Peut voir un objet domain'),)}, ), migrations.AlterModelOptions( name='extension', options={'permissions': (('view_extension', 'Peut voir un objet extension'), ('use_all_extension', 'Peut utiliser toutes les extension'))}, ), migrations.AlterModelOptions( name='interface', options={'permissions': (('view_interface', 'Peut voir un objet interface'), ('change_interface_machine', "Peut changer le propriétaire d'une interface"))}, ), migrations.AlterModelOptions( name='iplist', options={'permissions': (('view_iplist', 'Peut voir un objet iplist'),)}, ), migrations.AlterModelOptions( name='iptype', options={'permissions': (('view_iptype', 'Peut voir un objet iptype'), ('use_all_iptype', 'Peut utiliser tous les iptype'))}, ), migrations.AlterModelOptions( name='machine', options={'permissions': (('view_machine', 'Peut voir un objet machine quelquonque'), ('change_machine_user', "Peut changer le propriétaire d'une machine"))}, ), migrations.AlterModelOptions( name='machinetype', options={'permissions': (('view_machinetype', 'Peut voir un objet machinetype'), ('use_all_machinetype', "Peut utiliser n'importe quel type de machine"))}, ), migrations.AlterModelOptions( name='mx', options={'permissions': (('view_mx', 'Peut voir un objet mx'),)}, ), migrations.AlterModelOptions( name='nas', options={'permissions': (('view_nas', 'Peut voir un objet Nas'),)}, ), migrations.AlterModelOptions( name='ns', options={'permissions': (('view_ns', 'Peut voir un objet ns'),)}, ), migrations.AlterModelOptions( name='ouvertureportlist', options={'permissions': (('view_ouvertureportlist', 'Peut voir un objet ouvertureport'),)}, ), migrations.AlterModelOptions( name='service', options={'permissions': (('view_service', 'Peut voir un objet service'),)}, ), migrations.AlterModelOptions( name='soa', options={'permissions': (('view_soa', 'Peut voir un objet soa'),)}, ), migrations.AlterModelOptions( name='srv', options={'permissions': (('view_soa', 'Peut voir un objet soa'),)}, ), migrations.AlterModelOptions( name='txt', options={'permissions': (('view_txt', 'Peut voir un objet txt'),)}, ), migrations.AlterModelOptions( name='vlan', options={'permissions': (('view_vlan', 'Peut voir un objet vlan'),)}, ), migrations.CreateModel( name='Ipv6List', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('ipv6', models.GenericIPAddressField(protocol='IPv6', unique=True)), ('slaac_ip', models.BooleanField(default=False)), ('interface', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Interface')), ], ), migrations.AlterUniqueTogether( name='ipv6list', unique_together=set([('interface', 'slaac_ip')]), ), migrations.AlterModelOptions( name='ipv6list', options={'permissions': (('view_ipv6list', 'Peut voir un objet ipv6'), ('change_ipv6list_slaac_ip', 'Peut changer la valeur slaac sur une ipv6'))}, ), migrations.AlterUniqueTogether( name='ipv6list', unique_together=set([]), ), migrations.AlterField( model_name='ipv6list', name='interface', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ipv6list', to='machines.Interface'), ), ]