2015-11-05 21:54:21 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import migrations, models
|
|
|
|
import django.utils.timezone
|
|
|
|
from django.conf import settings
|
|
|
|
import model_utils.fields
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
|
|
('domains', '0002_auto_20150124_1909'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSComment',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('name', models.CharField(max_length=255)),
|
2018-11-19 23:28:40 +01:00
|
|
|
('commenttype',
|
|
|
|
models.CharField(max_length=10, db_column='type')),
|
2015-11-05 21:54:21 +01:00
|
|
|
('modified_at', models.IntegerField()),
|
|
|
|
('comment', models.CharField(max_length=65535)),
|
2018-11-19 23:28:40 +01:00
|
|
|
('customer', models.ForeignKey(
|
|
|
|
verbose_name='customer',
|
|
|
|
to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
|
2015-11-05 21:54:21 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.RunSQL(
|
|
|
|
'''ALTER TABLE domains_dnscomment ADD CONSTRAINT c_lowercase_name
|
2018-11-19 23:28:40 +01:00
|
|
|
CHECK (((name)::TEXT = LOWER((name)::TEXT)))'''
|
2015-11-05 21:54:21 +01:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSCryptoKey',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('flags', models.IntegerField()),
|
|
|
|
('active', models.BooleanField(default=True)),
|
|
|
|
('content', models.TextField()),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSDomain',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
|
|
|
('created', model_utils.fields.AutoCreatedField(
|
|
|
|
default=django.utils.timezone.now, verbose_name='created',
|
|
|
|
editable=False)),
|
|
|
|
('modified', model_utils.fields.AutoLastModifiedField(
|
|
|
|
default=django.utils.timezone.now, verbose_name='modified',
|
|
|
|
editable=False)),
|
|
|
|
('domain', models.CharField(
|
|
|
|
unique=True, max_length=255, verbose_name='domain name')),
|
|
|
|
('master',
|
|
|
|
models.CharField(max_length=128, null=True, blank=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('last_check', models.IntegerField(null=True)),
|
2018-11-19 23:28:40 +01:00
|
|
|
('domaintype', models.CharField(
|
|
|
|
max_length=6, db_column='type',
|
|
|
|
choices=[('MASTER', 'Master'),
|
|
|
|
('SLAVE', 'Slave'),
|
|
|
|
('NATIVE', 'Native')])),
|
2015-11-05 21:54:21 +01:00
|
|
|
('notified_serial', models.IntegerField(null=True)),
|
2018-11-19 23:28:40 +01:00
|
|
|
('customer', models.ForeignKey(
|
|
|
|
verbose_name='customer', blank=True,
|
|
|
|
to=settings.AUTH_USER_MODEL, null=True,
|
|
|
|
on_delete=models.CASCADE)),
|
2015-11-05 21:54:21 +01:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'DNS domain',
|
|
|
|
'verbose_name_plural': 'DNS domains',
|
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.RunSQL(
|
|
|
|
'''ALTER TABLE domains_dnsdomain ADD CONSTRAINT c_lowercase_name
|
|
|
|
CHECK (((domain)::TEXT = LOWER((domain)::TEXT)))'''
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSDomainMetadata',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('kind', models.CharField(max_length=32)),
|
|
|
|
('content', models.TextField()),
|
2018-11-19 23:28:40 +01:00
|
|
|
('domain', models.ForeignKey(
|
|
|
|
to='domains.DNSDomain', on_delete=models.CASCADE)),
|
2015-11-05 21:54:21 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSRecord',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
|
|
|
('name', models.CharField(
|
|
|
|
db_index=True, max_length=255, null=True, blank=True)),
|
|
|
|
('recordtype', models.CharField(
|
|
|
|
max_length=10, null=True, db_column='type', blank=True)),
|
|
|
|
('content', models.CharField(
|
|
|
|
max_length=65535, null=True, blank=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('ttl', models.IntegerField(null=True)),
|
|
|
|
('prio', models.IntegerField(null=True)),
|
|
|
|
('change_date', models.IntegerField(null=True)),
|
|
|
|
('disabled', models.BooleanField(default=False)),
|
|
|
|
('ordername', models.CharField(max_length=255)),
|
|
|
|
('auth', models.BooleanField(default=True)),
|
2018-11-19 23:28:40 +01:00
|
|
|
('domain', models.ForeignKey(
|
|
|
|
to='domains.DNSDomain', on_delete=models.CASCADE)),
|
2015-11-05 21:54:21 +01:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'DNS record',
|
|
|
|
'verbose_name_plural': 'DNS records',
|
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.RunSQL(
|
|
|
|
'''ALTER TABLE domains_dnsrecord ADD CONSTRAINT c_lowercase_name
|
|
|
|
CHECK (((name)::TEXT = LOWER((name)::TEXT)))'''
|
|
|
|
),
|
|
|
|
migrations.RunSQL(
|
|
|
|
'''CREATE INDEX recordorder ON domains_dnsrecord (domain_id,
|
|
|
|
ordername text_pattern_ops)'''
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSSupermaster',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('ip', models.GenericIPAddressField()),
|
|
|
|
('nameserver', models.CharField(max_length=255)),
|
2018-11-19 23:28:40 +01:00
|
|
|
('customer', models.ForeignKey(
|
|
|
|
verbose_name='customer', to=settings.AUTH_USER_MODEL,
|
|
|
|
on_delete=models.CASCADE)),
|
2015-11-05 21:54:21 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='DNSTSIGKey',
|
|
|
|
fields=[
|
2018-11-19 23:28:40 +01:00
|
|
|
('id', models.AutoField(
|
|
|
|
verbose_name='ID', serialize=False,
|
|
|
|
auto_created=True, primary_key=True)),
|
2015-11-05 21:54:21 +01:00
|
|
|
('name', models.CharField(max_length=255)),
|
|
|
|
('algorithm', models.CharField(max_length=50)),
|
|
|
|
('secret', models.CharField(max_length=255)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.RunSQL(
|
|
|
|
'''ALTER TABLE domains_dnstsigkey ADD CONSTRAINT c_lowercase_name
|
|
|
|
CHECK (((name)::TEXT = LOWER((name)::TEXT)))'''
|
|
|
|
),
|
|
|
|
migrations.AlterField(
|
|
|
|
model_name='hostingdomain',
|
|
|
|
name='domain',
|
2018-11-19 23:28:40 +01:00
|
|
|
field=models.CharField(
|
|
|
|
unique=True, max_length=255, verbose_name='domain name'),
|
2015-11-05 21:54:21 +01:00
|
|
|
),
|
|
|
|
migrations.AlterField(
|
|
|
|
model_name='maildomain',
|
|
|
|
name='domain',
|
2018-11-19 23:28:40 +01:00
|
|
|
field=models.CharField(
|
|
|
|
unique=True, max_length=255, verbose_name='domain name'),
|
2015-11-05 21:54:21 +01:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='dnscryptokey',
|
|
|
|
name='domain',
|
2018-11-19 23:28:40 +01:00
|
|
|
field=models.ForeignKey(
|
|
|
|
to='domains.DNSDomain', on_delete=models.CASCADE),
|
2015-11-05 21:54:21 +01:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='dnscomment',
|
|
|
|
name='domain',
|
2018-11-19 23:28:40 +01:00
|
|
|
field=models.ForeignKey(
|
|
|
|
to='domains.DNSDomain', on_delete=models.CASCADE),
|
2015-11-05 21:54:21 +01:00
|
|
|
),
|
|
|
|
migrations.AlterUniqueTogether(
|
|
|
|
name='dnssupermaster',
|
|
|
|
unique_together=set([('ip', 'nameserver')]),
|
|
|
|
),
|
|
|
|
migrations.AlterUniqueTogether(
|
|
|
|
name='dnstsigkey',
|
|
|
|
unique_together=set([('name', 'algorithm')]),
|
|
|
|
),
|
|
|
|
migrations.AlterIndexTogether(
|
|
|
|
name='dnsrecord',
|
|
|
|
index_together=set([('name', 'recordtype')]),
|
|
|
|
),
|
|
|
|
migrations.AlterIndexTogether(
|
|
|
|
name='dnscomment',
|
2018-11-19 23:28:40 +01:00
|
|
|
index_together={('name', 'commenttype'), ('domain', 'modified_at')},
|
2015-11-05 21:54:21 +01:00
|
|
|
),
|
|
|
|
]
|