0015_rrset.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # -*- coding: utf-8 -*-
  2. # Generated by Django 1.10.3 on 2017-05-08 13:20
  3. from __future__ import unicode_literals
  4. import desecapi.models
  5. import django.core.validators
  6. from django.db import migrations, models
  7. import django.db.models.deletion
  8. class Migration(migrations.Migration):
  9. dependencies = [
  10. ('desecapi', '0014_ip_validation'),
  11. ]
  12. operations = [
  13. migrations.CreateModel(
  14. name='RRset',
  15. fields=[
  16. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  17. ('created', models.DateTimeField(auto_now_add=True)),
  18. ('updated', models.DateTimeField(null=True)),
  19. ('subname', models.CharField(blank=True, max_length=178)),
  20. ('type', models.CharField(max_length=10, validators=[desecapi.models.validate_upper])),
  21. # max_length is due to row length limit and lifted later when we switch the charset from utf8 to latin1.
  22. ('records', models.CharField(blank=True, max_length=16000)),
  23. ('ttl', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1)])),
  24. ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rrsets', to='desecapi.Domain')),
  25. ],
  26. ),
  27. migrations.AlterUniqueTogether(
  28. name='rrset',
  29. unique_together=set([('domain', 'subname', 'type')]),
  30. ),
  31. # Here we extend the row length as we change the charset accordingly. We also tell Django what the new field state is.
  32. migrations.RunSQL(
  33. "ALTER TABLE desecapi_rrset MODIFY records VARCHAR(64000) CHARACTER SET latin1 NOT NULL;",
  34. state_operations=[
  35. migrations.AlterField(
  36. model_name='rrset',
  37. name='records',
  38. field=models.CharField(blank=True, max_length=64000),
  39. ),
  40. ],
  41. ),
  42. ]