From 7fa7106d72514b1536eac25dd76cbe9bdee666f2 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 22 Apr 2021 14:18:01 +0200 Subject: [PATCH] Update migrations to include mandatory on_delete Django 2.0 --- .../contrib/accounts/migrations/0001_initial.py | 3 ++- .../contrib/bills/migrations/0001_initial.py | 10 +++++----- .../bills/migrations/0005_auto_20150623_1031.py | 3 ++- .../contrib/contacts/migrations/0001_initial.py | 3 ++- .../contrib/databases/migrations/0001_initial.py | 5 +++-- .../contrib/domains/migrations/0001_initial.py | 7 ++++--- .../domains/migrations/0005_auto_20160219_1034.py | 3 ++- .../contrib/issues/migrations/0001_initial.py | 15 ++++++++------- .../contrib/lists/migrations/0001_initial.py | 5 +++-- .../contrib/mailboxes/migrations/0001_initial.py | 9 +++++---- .../contrib/mailer/migrations/0001_initial.py | 3 ++- .../miscellaneous/migrations/0001_initial.py | 5 +++-- .../orchestration/migrations/0001_initial.py | 9 +++++---- .../contrib/orders/migrations/0001_initial.py | 9 +++++---- .../contrib/payments/migrations/0001_initial.py | 9 +++++---- .../contrib/plans/migrations/0001_initial.py | 9 +++++---- .../plans/migrations/0002_auto_20160114_1713.py | 3 ++- .../contrib/resources/migrations/0001_initial.py | 11 ++++++----- orchestra/contrib/saas/migrations/0001_initial.py | 5 +++-- .../contrib/services/migrations/0001_initial.py | 3 ++- .../migrations/0002_auto_20150429_1413.py | 3 ++- orchestra/contrib/vps/migrations/0001_initial.py | 3 ++- .../contrib/webapps/migrations/0001_initial.py | 5 +++-- .../contrib/websites/migrations/0001_initial.py | 9 +++++---- 24 files changed, 86 insertions(+), 63 deletions(-) diff --git a/orchestra/contrib/accounts/migrations/0001_initial.py b/orchestra/contrib/accounts/migrations/0001_initial.py index e6ff1344..a855bc5f 100644 --- a/orchestra/contrib/accounts/migrations/0001_initial.py +++ b/orchestra/contrib/accounts/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations import django.core.validators +import django.db.models.deletion import django.utils.timezone import django.contrib.auth.models @@ -32,7 +33,7 @@ class Migration(migrations.Migration): ('is_superuser', models.BooleanField(help_text='Designates that this user has all permissions without explicitly assigning them.', default=False, verbose_name='superuser status')), ('is_active', models.BooleanField(help_text='Designates whether this account should be treated as active. Unselect this instead of deleting accounts.', default=True, verbose_name='active')), ('date_joined', models.DateTimeField(verbose_name='date joined', default=django.utils.timezone.now)), - ('main_systemuser', models.ForeignKey(to='systemusers.SystemUser', editable=False, null=True, related_name='accounts_main')), + ('main_systemuser', models.ForeignKey(to='systemusers.SystemUser', editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='accounts_main')), ], options={ 'abstract': False, diff --git a/orchestra/contrib/bills/migrations/0001_initial.py b/orchestra/contrib/bills/migrations/0001_initial.py index a572887e..ba1d9dcb 100644 --- a/orchestra/contrib/bills/migrations/0001_initial.py +++ b/orchestra/contrib/bills/migrations/0001_initial.py @@ -30,7 +30,7 @@ class Migration(migrations.Migration): ('total', models.DecimalField(default=0, decimal_places=2, max_digits=12)), ('comments', models.TextField(verbose_name='comments', blank=True)), ('html', models.TextField(verbose_name='HTML', blank=True)), - ('account', models.ForeignKey(related_name='bill', to=settings.AUTH_USER_MODEL, verbose_name='account')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bill', to=settings.AUTH_USER_MODEL, verbose_name='account')), ], options={ 'get_latest_by': 'id', @@ -46,7 +46,7 @@ class Migration(migrations.Migration): ('zipcode', models.CharField(verbose_name='zip code', validators=[django.core.validators.RegexValidator('^[0-9A-Z]{3,10}$', 'Enter a valid zipcode.')], max_length=10)), ('country', models.CharField(default='ES', verbose_name='country', choices=[('PR', 'Puerto Rico'), ('BV', 'Bouvet Island'), ('BT', 'Bhutan'), ('MY', 'Malaysia'), ('AQ', 'Antarctica'), ('MT', 'Malta'), ('BE', 'Belgium'), ('SM', 'San Marino'), ('AZ', 'Azerbaijan'), ('CA', 'Canada'), ('HR', 'Croatia'), ('GH', 'Ghana'), ('MZ', 'Mozambique'), ('PA', 'Panama'), ('GR', 'Greece'), ('AE', 'United Arab Emirates'), ('CK', 'Cook Islands'), ('SK', 'Slovakia'), ('PN', 'Pitcairn'), ('ZA', 'South Africa'), ('AU', 'Australia'), ('BF', 'Burkina Faso'), ('FI', 'Finland'), ('MC', 'Monaco'), ('RE', 'Réunion'), ('TV', 'Tuvalu'), ('HN', 'Honduras'), ('IL', 'Israel'), ('SV', 'El Salvador'), ('VN', 'Viet Nam'), ('MV', 'Maldives'), ('BA', 'Bosnia and Herzegovina'), ('UA', 'Ukraine'), ('BW', 'Botswana'), ('UZ', 'Uzbekistan'), ('ID', 'Indonesia'), ('LY', 'Libya'), ('MM', 'Myanmar'), ('TZ', 'Tanzania, United Republic of'), ('GL', 'Greenland'), ('LV', 'Latvia'), ('DZ', 'Algeria'), ('AO', 'Angola'), ('GE', 'Georgia'), ('SO', 'Somalia'), ('CX', 'Christmas Island'), ('NP', 'Nepal'), ('AI', 'Anguilla'), ('GP', 'Guadeloupe'), ('UY', 'Uruguay'), ('LC', 'Saint Lucia'), ('EH', 'Western Sahara'), ('IO', 'British Indian Ocean Territory'), ('TH', 'Thailand'), ('AR', 'Argentina'), ('PY', 'Paraguay'), ('AW', 'Aruba'), ('IE', 'Ireland'), ('CF', 'Central African Republic'), ('TW', 'Taiwan (Province of China)'), ('KZ', 'Kazakhstan'), ('TJ', 'Tajikistan'), ('RW', 'Rwanda'), ('SR', 'Suriname'), ('AT', 'Austria'), ('GN', 'Guinea'), ('SS', 'South Sudan'), ('IT', 'Italy'), ('BO', 'Bolivia (Plurinational State of)'), ('GD', 'Grenada'), ('KE', 'Kenya'), ('GS', 'South Georgia and the South Sandwich Islands'), ('TG', 'Togo'), ('CY', 'Cyprus'), ('TT', 'Trinidad and Tobago'), ('CM', 'Cameroon'), ('QA', 'Qatar'), ('GM', 'Gambia'), ('WS', 'Samoa'), ('DJ', 'Djibouti'), ('PL', 'Poland'), ('CV', 'Cabo Verde'), ('PE', 'Peru'), ('TN', 'Tunisia'), ('HT', 'Haiti'), ('AF', 'Afghanistan'), ('YT', 'Mayotte'), ('NR', 'Nauru'), ('LS', 'Lesotho'), ('LR', 'Liberia'), ('IR', 'Iran (Islamic Republic of)'), ('EE', 'Estonia'), ('ER', 'Eritrea'), ('RU', 'Russian Federation'), ('LB', 'Lebanon'), ('CU', 'Cuba'), ('CZ', 'Czech Republic'), ('AX', 'Åland Islands'), ('CD', 'Congo (the Democratic Republic of the)'), ('HK', 'Hong Kong'), ('PS', 'Palestine, State of'), ('FK', 'Falkland Islands [Malvinas]'), ('MR', 'Mauritania'), ('MG', 'Madagascar'), ('MH', 'Marshall Islands'), ('LK', 'Sri Lanka'), ('NA', 'Namibia'), ('SI', 'Slovenia'), ('BY', 'Belarus'), ('MX', 'Mexico'), ('ZW', 'Zimbabwe'), ('CI', "Côte d'Ivoire"), ('GU', 'Guam'), ('PW', 'Palau'), ('SC', 'Seychelles'), ('GT', 'Guatemala'), ('CL', 'Chile'), ('SH', 'Saint Helena, Ascension and Tristan da Cunha'), ('BH', 'Bahrain'), ('SB', 'Solomon Islands'), ('KM', 'Comoros'), ('MF', 'Saint Martin (French part)'), ('FO', 'Faroe Islands'), ('BD', 'Bangladesh'), ('AM', 'Armenia'), ('BJ', 'Benin'), ('SA', 'Saudi Arabia'), ('NU', 'Niue'), ('VI', 'Virgin Islands (U.S.)'), ('CN', 'China'), ('EC', 'Ecuador'), ('CC', 'Cocos (Keeling) Islands'), ('BS', 'Bahamas'), ('JM', 'Jamaica'), ('RO', 'Romania'), ('KI', 'Kiribati'), ('GY', 'Guyana'), ('TL', 'Timor-Leste'), ('AS', 'American Samoa'), ('VE', 'Venezuela (Bolivarian Republic of)'), ('BN', 'Brunei Darussalam'), ('ET', 'Ethiopia'), ('FJ', 'Fiji'), ('BG', 'Bulgaria'), ('VG', 'Virgin Islands (British)'), ('AD', 'Andorra'), ('KN', 'Saint Kitts and Nevis'), ('MA', 'Morocco'), ('MU', 'Mauritius'), ('DK', 'Denmark'), ('TO', 'Tonga'), ('CO', 'Colombia'), ('GA', 'Gabon'), ('MK', 'Macedonia (the former Yugoslav Republic of)'), ('MD', 'Moldova (the Republic of)'), ('VA', 'Holy See'), ('KY', 'Cayman Islands'), ('LU', 'Luxembourg'), ('AL', 'Albania'), ('LI', 'Liechtenstein'), ('KP', "Korea (the Democratic People's Republic of)"), ('BZ', 'Belize'), ('ME', 'Montenegro'), ('NC', 'New Caledonia'), ('VC', 'Saint Vincent and the Grenadines'), ('UM', 'United States Minor Outlying Islands'), ('IQ', 'Iraq'), ('GB', 'United Kingdom of Great Britain and Northern Ireland'), ('KW', 'Kuwait'), ('MS', 'Montserrat'), ('SD', 'Sudan'), ('JP', 'Japan'), ('DE', 'Germany'), ('SN', 'Senegal'), ('PK', 'Pakistan'), ('MO', 'Macao'), ('RS', 'Serbia'), ('KR', 'Korea (the Republic of)'), ('BL', 'Saint Barthélemy'), ('MP', 'Northern Mariana Islands'), ('AG', 'Antigua and Barbuda'), ('FM', 'Micronesia (Federated States of)'), ('HM', 'Heard Island and McDonald Islands'), ('BR', 'Brazil'), ('PF', 'French Polynesia'), ('MQ', 'Martinique'), ('VU', 'Vanuatu'), ('LT', 'Lithuania'), ('ES', 'Spain'), ('ML', 'Mali'), ('NE', 'Niger'), ('EG', 'Egypt'), ('WF', 'Wallis and Futuna'), ('ZM', 'Zambia'), ('US', 'United States of America'), ('DO', 'Dominican Republic'), ('NO', 'Norway'), ('UG', 'Uganda'), ('GQ', 'Equatorial Guinea'), ('GW', 'Guinea-Bissau'), ('JE', 'Jersey'), ('HU', 'Hungary'), ('BQ', 'Bonaire, Sint Eustatius and Saba'), ('JO', 'Jordan'), ('ST', 'Sao Tome and Principe'), ('SJ', 'Svalbard and Jan Mayen'), ('MN', 'Mongolia'), ('BB', 'Barbados'), ('CH', 'Switzerland'), ('KG', 'Kyrgyzstan'), ('PG', 'Papua New Guinea'), ('NG', 'Nigeria'), ('GF', 'French Guiana'), ('CR', 'Costa Rica'), ('LA', "Lao People's Democratic Republic"), ('CG', 'Congo'), ('NI', 'Nicaragua'), ('TK', 'Tokelau'), ('SE', 'Sweden'), ('NF', 'Norfolk Island'), ('PT', 'Portugal'), ('FR', 'France'), ('SZ', 'Swaziland'), ('YE', 'Yemen'), ('NL', 'Netherlands'), ('GI', 'Gibraltar'), ('TR', 'Turkey'), ('OM', 'Oman'), ('TF', 'French Southern Territories'), ('PM', 'Saint Pierre and Miquelon'), ('TC', 'Turks and Caicos Islands'), ('SL', 'Sierra Leone'), ('SX', 'Sint Maarten (Dutch part)'), ('DM', 'Dominica'), ('KH', 'Cambodia'), ('SG', 'Singapore'), ('BM', 'Bermuda'), ('CW', 'Curaçao'), ('GG', 'Guernsey'), ('TD', 'Chad'), ('IN', 'India'), ('BI', 'Burundi'), ('TM', 'Turkmenistan'), ('IS', 'Iceland'), ('MW', 'Malawi'), ('SY', 'Syrian Arab Republic'), ('NZ', 'New Zealand'), ('IM', 'Isle of Man'), ('PH', 'Philippines')], max_length=20)), ('vat', models.CharField(verbose_name='VAT number', max_length=64)), - ('account', models.OneToOneField(related_name='billcontact', to=settings.AUTH_USER_MODEL, verbose_name='account')), + ('account', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='billcontact', to=settings.AUTH_USER_MODEL, verbose_name='account')), ], ), migrations.CreateModel( @@ -64,8 +64,8 @@ class Migration(migrations.Migration): ('order_billed_on', models.DateField(verbose_name='order billed', null=True, blank=True)), ('order_billed_until', models.DateField(verbose_name='order billed until', null=True, blank=True)), ('created_on', models.DateField(auto_now_add=True, verbose_name='created')), - ('amended_line', models.ForeignKey(blank=True, to='bills.BillLine', verbose_name='amended line', null=True, related_name='amendment_lines')), - ('bill', models.ForeignKey(related_name='lines', to='bills.Bill', verbose_name='bill')), + ('amended_line', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='bills.BillLine', verbose_name='amended line', null=True, related_name='amendment_lines')), + ('bill', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='bills.Bill', verbose_name='bill')), ('order', models.ForeignKey(blank=True, to='orders.Order', null=True, on_delete=django.db.models.deletion.SET_NULL, help_text='Informative link back to the order')), ], ), @@ -76,7 +76,7 @@ class Migration(migrations.Migration): ('description', models.CharField(verbose_name='description', max_length=256)), ('total', models.DecimalField(decimal_places=2, max_digits=12)), ('type', models.CharField(default='OTHER', verbose_name='type', choices=[('VOLUME', 'Volume'), ('COMPENSATION', 'Compensation'), ('OTHER', 'Other')], max_length=16)), - ('line', models.ForeignKey(related_name='sublines', to='bills.BillLine', verbose_name='bill line')), + ('line', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sublines', to='bills.BillLine', verbose_name='bill line')), ], ), migrations.CreateModel( diff --git a/orchestra/contrib/bills/migrations/0005_auto_20150623_1031.py b/orchestra/contrib/bills/migrations/0005_auto_20150623_1031.py index d00b968e..92aba3b9 100644 --- a/orchestra/contrib/bills/migrations/0005_auto_20150623_1031.py +++ b/orchestra/contrib/bills/migrations/0005_auto_20150623_1031.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import django.db.models.deletion from django.db import models, migrations @@ -14,7 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='bill', name='amend_of', - field=models.ForeignKey(to='bills.Bill', blank=True, related_name='amends', verbose_name='amend of', null=True), + field=models.ForeignKey(to='bills.Bill', blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='amends', verbose_name='amend of', null=True), ), migrations.AlterField( model_name='billcontact', diff --git a/orchestra/contrib/contacts/migrations/0001_initial.py b/orchestra/contrib/contacts/migrations/0001_initial.py index 5b66d4cf..a3e5ae07 100644 --- a/orchestra/contrib/contacts/migrations/0001_initial.py +++ b/orchestra/contrib/contacts/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations import django.core.validators +import django.db.models.deletion import orchestra.contrib.contacts.validators import orchestra.models.fields from django.conf import settings @@ -29,7 +30,7 @@ class Migration(migrations.Migration): ('city', models.CharField(max_length=128, verbose_name='city', blank=True)), ('zipcode', models.CharField(max_length=10, blank=True, validators=[django.core.validators.RegexValidator('^[0-9,A-Z]{3,10}$', 'Enter a valid zipcode.', 'invalid')], verbose_name='zip code')), ('country', models.CharField(choices=[('VC', 'Saint Vincent and the Grenadines'), ('TM', 'Turkmenistan'), ('CL', 'Chile'), ('BN', 'Brunei Darussalam'), ('IS', 'Iceland'), ('AM', 'Armenia'), ('FI', 'Finland'), ('TK', 'Tokelau'), ('AF', 'Afghanistan'), ('IE', 'Ireland'), ('CW', 'Curaçao'), ('PY', 'Paraguay'), ('WF', 'Wallis and Futuna'), ('PK', 'Pakistan'), ('JP', 'Japan'), ('AO', 'Angola'), ('FM', 'Micronesia (Federated States of)'), ('SH', 'Saint Helena, Ascension and Tristan da Cunha'), ('SG', 'Singapore'), ('BL', 'Saint Barthélemy'), ('MK', 'Macedonia (the former Yugoslav Republic of)'), ('MY', 'Malaysia'), ('IM', 'Isle of Man'), ('GW', 'Guinea-Bissau'), ('IQ', 'Iraq'), ('GR', 'Greece'), ('VA', 'Holy See'), ('RW', 'Rwanda'), ('GD', 'Grenada'), ('TZ', 'Tanzania, United Republic of'), ('DZ', 'Algeria'), ('BF', 'Burkina Faso'), ('HU', 'Hungary'), ('TT', 'Trinidad and Tobago'), ('LU', 'Luxembourg'), ('BA', 'Bosnia and Herzegovina'), ('ET', 'Ethiopia'), ('TG', 'Togo'), ('RU', 'Russian Federation'), ('EG', 'Egypt'), ('RO', 'Romania'), ('SR', 'Suriname'), ('GB', 'United Kingdom of Great Britain and Northern Ireland'), ('JM', 'Jamaica'), ('HK', 'Hong Kong'), ('BH', 'Bahrain'), ('KM', 'Comoros'), ('HN', 'Honduras'), ('TD', 'Chad'), ('RS', 'Serbia'), ('PH', 'Philippines'), ('PE', 'Peru'), ('UA', 'Ukraine'), ('AE', 'United Arab Emirates'), ('KW', 'Kuwait'), ('GE', 'Georgia'), ('NA', 'Namibia'), ('CZ', 'Czech Republic'), ('CY', 'Cyprus'), ('LA', "Lao People's Democratic Republic"), ('BZ', 'Belize'), ('MX', 'Mexico'), ('MZ', 'Mozambique'), ('FR', 'France'), ('KG', 'Kyrgyzstan'), ('PW', 'Palau'), ('MG', 'Madagascar'), ('AU', 'Australia'), ('AI', 'Anguilla'), ('UZ', 'Uzbekistan'), ('NL', 'Netherlands'), ('VI', 'Virgin Islands (U.S.)'), ('LT', 'Lithuania'), ('WS', 'Samoa'), ('PA', 'Panama'), ('CO', 'Colombia'), ('AL', 'Albania'), ('PN', 'Pitcairn'), ('SC', 'Seychelles'), ('CH', 'Switzerland'), ('DO', 'Dominican Republic'), ('AW', 'Aruba'), ('GH', 'Ghana'), ('MM', 'Myanmar'), ('ML', 'Mali'), ('PS', 'Palestine, State of'), ('UY', 'Uruguay'), ('MN', 'Mongolia'), ('NE', 'Niger'), ('FK', 'Falkland Islands [Malvinas]'), ('US', 'United States of America'), ('BD', 'Bangladesh'), ('SB', 'Solomon Islands'), ('ZA', 'South Africa'), ('SJ', 'Svalbard and Jan Mayen'), ('IT', 'Italy'), ('HT', 'Haiti'), ('BW', 'Botswana'), ('MA', 'Morocco'), ('GP', 'Guadeloupe'), ('NI', 'Nicaragua'), ('CU', 'Cuba'), ('GL', 'Greenland'), ('MQ', 'Martinique'), ('NZ', 'New Zealand'), ('DE', 'Germany'), ('GY', 'Guyana'), ('YT', 'Mayotte'), ('MR', 'Mauritania'), ('IR', 'Iran (Islamic Republic of)'), ('SL', 'Sierra Leone'), ('MD', 'Moldova (the Republic of)'), ('SM', 'San Marino'), ('SS', 'South Sudan'), ('DM', 'Dominica'), ('NG', 'Nigeria'), ('UM', 'United States Minor Outlying Islands'), ('BI', 'Burundi'), ('GU', 'Guam'), ('GQ', 'Equatorial Guinea'), ('UG', 'Uganda'), ('VU', 'Vanuatu'), ('GT', 'Guatemala'), ('TR', 'Turkey'), ('BO', 'Bolivia (Plurinational State of)'), ('MP', 'Northern Mariana Islands'), ('AQ', 'Antarctica'), ('BS', 'Bahamas'), ('SK', 'Slovakia'), ('BY', 'Belarus'), ('AR', 'Argentina'), ('QA', 'Qatar'), ('LV', 'Latvia'), ('EH', 'Western Sahara'), ('LK', 'Sri Lanka'), ('LB', 'Lebanon'), ('JE', 'Jersey'), ('DJ', 'Djibouti'), ('LC', 'Saint Lucia'), ('CF', 'Central African Republic'), ('KE', 'Kenya'), ('NF', 'Norfolk Island'), ('FO', 'Faroe Islands'), ('BQ', 'Bonaire, Sint Eustatius and Saba'), ('TF', 'French Southern Territories'), ('TC', 'Turks and Caicos Islands'), ('GM', 'Gambia'), ('PF', 'French Polynesia'), ('DK', 'Denmark'), ('GI', 'Gibraltar'), ('SN', 'Senegal'), ('ER', 'Eritrea'), ('CR', 'Costa Rica'), ('AZ', 'Azerbaijan'), ('BR', 'Brazil'), ('SE', 'Sweden'), ('SI', 'Slovenia'), ('SV', 'El Salvador'), ('TO', 'Tonga'), ('LR', 'Liberia'), ('CV', 'Cabo Verde'), ('OM', 'Oman'), ('KR', 'Korea (the Republic of)'), ('BV', 'Bouvet Island'), ('CA', 'Canada'), ('CK', 'Cook Islands'), ('BG', 'Bulgaria'), ('ZW', 'Zimbabwe'), ('FJ', 'Fiji'), ('NU', 'Niue'), ('YE', 'Yemen'), ('CM', 'Cameroon'), ('ZM', 'Zambia'), ('MC', 'Monaco'), ('SX', 'Sint Maarten (Dutch part)'), ('VG', 'Virgin Islands (British)'), ('AD', 'Andorra'), ('MF', 'Saint Martin (French part)'), ('PM', 'Saint Pierre and Miquelon'), ('RE', 'Réunion'), ('SO', 'Somalia'), ('AG', 'Antigua and Barbuda'), ('MH', 'Marshall Islands'), ('TW', 'Taiwan (Province of China)'), ('EE', 'Estonia'), ('NP', 'Nepal'), ('TV', 'Tuvalu'), ('NC', 'New Caledonia'), ('ME', 'Montenegro'), ('CX', 'Christmas Island'), ('LY', 'Libya'), ('KP', "Korea (the Democratic People's Republic of)"), ('SD', 'Sudan'), ('VE', 'Venezuela (Bolivarian Republic of)'), ('KZ', 'Kazakhstan'), ('MV', 'Maldives'), ('CI', "Côte d'Ivoire"), ('VN', 'Viet Nam'), ('IN', 'India'), ('GN', 'Guinea'), ('AX', 'Åland Islands'), ('ST', 'Sao Tome and Principe'), ('HR', 'Croatia'), ('HM', 'Heard Island and McDonald Islands'), ('MO', 'Macao'), ('MS', 'Montserrat'), ('AT', 'Austria'), ('NO', 'Norway'), ('BT', 'Bhutan'), ('PT', 'Portugal'), ('IO', 'British Indian Ocean Territory'), ('KN', 'Saint Kitts and Nevis'), ('PL', 'Poland'), ('MW', 'Malawi'), ('LS', 'Lesotho'), ('SZ', 'Swaziland'), ('TJ', 'Tajikistan'), ('NR', 'Nauru'), ('MT', 'Malta'), ('ES', 'Spain'), ('BB', 'Barbados'), ('CG', 'Congo'), ('PG', 'Papua New Guinea'), ('GS', 'South Georgia and the South Sandwich Islands'), ('TN', 'Tunisia'), ('MU', 'Mauritius'), ('TH', 'Thailand'), ('BJ', 'Benin'), ('KY', 'Cayman Islands'), ('ID', 'Indonesia'), ('CD', 'Congo (the Democratic Republic of the)'), ('KI', 'Kiribati'), ('IL', 'Israel'), ('CN', 'China'), ('SA', 'Saudi Arabia'), ('AS', 'American Samoa'), ('KH', 'Cambodia'), ('JO', 'Jordan'), ('SY', 'Syrian Arab Republic'), ('LI', 'Liechtenstein'), ('GF', 'French Guiana'), ('EC', 'Ecuador'), ('CC', 'Cocos (Keeling) Islands'), ('TL', 'Timor-Leste'), ('BE', 'Belgium'), ('PR', 'Puerto Rico'), ('GA', 'Gabon'), ('BM', 'Bermuda'), ('GG', 'Guernsey')], max_length=20, default='ES', verbose_name='country', blank=True)), - ('account', models.ForeignKey(null=True, related_name='contacts', to=settings.AUTH_USER_MODEL, verbose_name='Account')), + ('account', models.ForeignKey(null=True, related_name='contacts', on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Account')), ], ), ] diff --git a/orchestra/contrib/databases/migrations/0001_initial.py b/orchestra/contrib/databases/migrations/0001_initial.py index 47b3ff1b..e25696ac 100644 --- a/orchestra/contrib/databases/migrations/0001_initial.py +++ b/orchestra/contrib/databases/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings +import django.db.models.deletion import orchestra.core.validators @@ -19,7 +20,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)), ('name', models.CharField(verbose_name='name', max_length=64, validators=[orchestra.core.validators.validate_name])), ('type', models.CharField(default='mysql', choices=[('mysql', 'MySQL'), ('postgres', 'PostgreSQL')], verbose_name='type', max_length=32)), - ('account', models.ForeignKey(related_name='databases', verbose_name='Account', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='databases', verbose_name='Account', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -29,7 +30,7 @@ class Migration(migrations.Migration): ('username', models.CharField(verbose_name='username', max_length=16, validators=[orchestra.core.validators.validate_name])), ('password', models.CharField(verbose_name='password', max_length=256)), ('type', models.CharField(default='mysql', choices=[('mysql', 'MySQL'), ('postgres', 'PostgreSQL')], verbose_name='type', max_length=32)), - ('account', models.ForeignKey(related_name='databaseusers', verbose_name='Account', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='databaseusers', verbose_name='Account', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name_plural': 'DB users', diff --git a/orchestra/contrib/domains/migrations/0001_initial.py b/orchestra/contrib/domains/migrations/0001_initial.py index cb58ca78..f0877cd7 100644 --- a/orchestra/contrib/domains/migrations/0001_initial.py +++ b/orchestra/contrib/domains/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.contrib.domains.utils import orchestra.contrib.domains.validators from django.conf import settings @@ -20,8 +21,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), ('name', models.CharField(unique=True, max_length=256, validators=[orchestra.contrib.domains.validators.validate_domain_name, orchestra.contrib.domains.validators.validate_allowed_domain], verbose_name='name', help_text='Domain or subdomain name.')), ('serial', models.IntegerField(default=orchestra.contrib.domains.utils.generate_zone_serial, verbose_name='serial', help_text='Serial number')), - ('account', models.ForeignKey(related_name='domains', help_text='Automatically selected for subdomains.', to=settings.AUTH_USER_MODEL, verbose_name='Account', blank=True)), - ('top', models.ForeignKey(null=True, to='domains.Domain', editable=False, related_name='subdomain_set')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='domains', help_text='Automatically selected for subdomains.', to=settings.AUTH_USER_MODEL, verbose_name='Account', blank=True)), + ('top', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, null=True, to='domains.Domain', editable=False, related_name='subdomain_set')), ], ), migrations.CreateModel( @@ -31,7 +32,7 @@ class Migration(migrations.Migration): ('ttl', models.CharField(help_text='Record TTL, defaults to 1h', max_length=8, validators=[orchestra.contrib.domains.validators.validate_zone_interval], verbose_name='TTL', blank=True)), ('type', models.CharField(max_length=32, verbose_name='type', choices=[('MX', 'MX'), ('NS', 'NS'), ('CNAME', 'CNAME'), ('A', 'A (IPv4 address)'), ('AAAA', 'AAAA (IPv6 address)'), ('SRV', 'SRV'), ('TXT', 'TXT'), ('SOA', 'SOA')])), ('value', models.CharField(max_length=256, verbose_name='value')), - ('domain', models.ForeignKey(related_name='records', to='domains.Domain', verbose_name='domain')), + ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='records', to='domains.Domain', verbose_name='domain')), ], ), ] diff --git a/orchestra/contrib/domains/migrations/0005_auto_20160219_1034.py b/orchestra/contrib/domains/migrations/0005_auto_20160219_1034.py index 3d8a3c5c..7ef16e9b 100644 --- a/orchestra/contrib/domains/migrations/0005_auto_20160219_1034.py +++ b/orchestra/contrib/domains/migrations/0005_auto_20160219_1034.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion import orchestra.contrib.domains.validators @@ -20,7 +21,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='domain', name='top', - field=models.ForeignKey(editable=False, verbose_name='top domain', related_name='subdomain_set', to='domains.Domain', null=True), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, editable=False, verbose_name='top domain', related_name='subdomain_set', to='domains.Domain', null=True), ), migrations.AlterField( model_name='record', diff --git a/orchestra/contrib/issues/migrations/0001_initial.py b/orchestra/contrib/issues/migrations/0001_initial.py index 1dd5d46a..0c76499c 100644 --- a/orchestra/contrib/issues/migrations/0001_initial.py +++ b/orchestra/contrib/issues/migrations/0001_initial.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import django.db.models.deletion from django.db import models, migrations import orchestra.models.fields from django.conf import settings @@ -20,7 +21,7 @@ class Migration(migrations.Migration): ('author_name', models.CharField(blank=True, max_length=256, verbose_name='author name')), ('content', models.TextField(verbose_name='content')), ('created_on', models.DateTimeField(auto_now_add=True, verbose_name='created on')), - ('author', models.ForeignKey(related_name='ticket_messages', to=settings.AUTH_USER_MODEL, verbose_name='author')), + ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ticket_messages', to=settings.AUTH_USER_MODEL, verbose_name='author')), ], options={ 'get_latest_by': 'id', @@ -48,9 +49,9 @@ class Migration(migrations.Migration): ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='modified')), ('cc', models.TextField(blank=True, help_text='emails to send a carbon copy to', verbose_name='CC')), - ('creator', models.ForeignKey(related_name='tickets_created', null=True, to=settings.AUTH_USER_MODEL, verbose_name='created by')), - ('owner', models.ForeignKey(blank=True, related_name='tickets_owned', null=True, to=settings.AUTH_USER_MODEL, verbose_name='assigned to')), - ('queue', models.ForeignKey(blank=True, related_name='tickets', null=True, to='issues.Queue')), + ('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tickets_created', null=True, to=settings.AUTH_USER_MODEL, verbose_name='created by')), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, related_name='tickets_owned', null=True, to=settings.AUTH_USER_MODEL, verbose_name='assigned to')), + ('queue', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, related_name='tickets', null=True, to='issues.Queue')), ], options={ 'ordering': ['-updated_at'], @@ -60,14 +61,14 @@ class Migration(migrations.Migration): name='TicketTracker', fields=[ ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), - ('ticket', models.ForeignKey(related_name='trackers', to='issues.Ticket', verbose_name='ticket')), - ('user', models.ForeignKey(related_name='ticket_trackers', to=settings.AUTH_USER_MODEL, verbose_name='user')), + ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trackers', to='issues.Ticket', verbose_name='ticket')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ticket_trackers', to=settings.AUTH_USER_MODEL, verbose_name='user')), ], ), migrations.AddField( model_name='message', name='ticket', - field=models.ForeignKey(related_name='messages', to='issues.Ticket', verbose_name='ticket'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='issues.Ticket', verbose_name='ticket'), ), migrations.AlterUniqueTogether( name='tickettracker', diff --git a/orchestra/contrib/lists/migrations/0001_initial.py b/orchestra/contrib/lists/migrations/0001_initial.py index 73497c53..b6821076 100644 --- a/orchestra/contrib/lists/migrations/0001_initial.py +++ b/orchestra/contrib/lists/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings +import django.db.models.deletion import orchestra.core.validators @@ -22,8 +23,8 @@ class Migration(migrations.Migration): ('address_name', models.CharField(max_length=128, validators=[orchestra.core.validators.validate_name], verbose_name='address name', blank=True)), ('admin_email', models.EmailField(max_length=254, verbose_name='admin email', help_text='Administration email address')), ('is_active', models.BooleanField(default=True, verbose_name='active', help_text='Designates whether this account should be treated as active. Unselect this instead of deleting accounts.')), - ('account', models.ForeignKey(related_name='lists', to=settings.AUTH_USER_MODEL, verbose_name='Account')), - ('address_domain', models.ForeignKey(null=True, blank=True, to='domains.Domain', verbose_name='address domain')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lists', to=settings.AUTH_USER_MODEL, verbose_name='Account')), + ('address_domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, null=True, blank=True, to='domains.Domain', verbose_name='address domain')), ], ), migrations.AlterUniqueTogether( diff --git a/orchestra/contrib/mailboxes/migrations/0001_initial.py b/orchestra/contrib/mailboxes/migrations/0001_initial.py index 93dcc5fc..c2434c15 100644 --- a/orchestra/contrib/mailboxes/migrations/0001_initial.py +++ b/orchestra/contrib/mailboxes/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings +import django.db.models.deletion import orchestra.contrib.mailboxes.validators import django.core.validators @@ -21,8 +22,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(verbose_name='name', validators=[orchestra.contrib.mailboxes.validators.validate_emailname], blank=True, help_text='Address name, left blank for a catch-all address', max_length=64)), ('forward', models.CharField(verbose_name='forward', validators=[orchestra.contrib.mailboxes.validators.validate_forward], blank=True, help_text='Space separated email addresses or mailboxes', max_length=256)), - ('account', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='addresses', verbose_name='Account')), - ('domain', models.ForeignKey(to='domains.Domain', related_name='addresses', verbose_name='domain')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, related_name='addresses', verbose_name='Account')), + ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='domains.Domain', related_name='addresses', verbose_name='domain')), ], options={ 'verbose_name_plural': 'addresses', @@ -35,7 +36,7 @@ class Migration(migrations.Migration): ('subject', models.CharField(verbose_name='subject', max_length=256)), ('message', models.TextField(verbose_name='message')), ('enabled', models.BooleanField(verbose_name='enabled', default=False)), - ('address', models.OneToOneField(to='mailboxes.Address', related_name='autoresponse', verbose_name='address')), + ('address', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='mailboxes.Address', related_name='autoresponse', verbose_name='address')), ], ), migrations.CreateModel( @@ -47,7 +48,7 @@ class Migration(migrations.Migration): ('filtering', models.CharField(choices=[('CUSTOM', 'Custom filtering'), ('REDIRECT', 'Archive spam (X-Spam-Score≥9)'), ('DISABLE', 'Disable'), ('REJECT', 'Reject spam (X-Spam-Score≥9)')], max_length=16, default='REDIRECT')), ('custom_filtering', models.TextField(verbose_name='filtering', validators=[orchestra.contrib.mailboxes.validators.validate_sieve], blank=True, help_text='Arbitrary email filtering in sieve language. This overrides any automatic junk email filtering')), ('is_active', models.BooleanField(verbose_name='active', default=True)), - ('account', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='mailboxes', verbose_name='account')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, related_name='mailboxes', verbose_name='account')), ], options={ 'verbose_name_plural': 'mailboxes', diff --git a/orchestra/contrib/mailer/migrations/0001_initial.py b/orchestra/contrib/mailer/migrations/0001_initial.py index 4b19ca88..ca6dcd3b 100644 --- a/orchestra/contrib/mailer/migrations/0001_initial.py +++ b/orchestra/contrib/mailer/migrations/0001_initial.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import django.db.models.deletion from django.db import models, migrations @@ -32,7 +33,7 @@ class Migration(migrations.Migration): ('result', models.CharField(choices=[('SUCCESS', 'Success'), ('FAILURE', 'Failure')], default='SUCCESS', max_length=16)), ('date', models.DateTimeField(auto_now_add=True)), ('log_message', models.TextField()), - ('message', models.ForeignKey(to='mailer.Message', editable=False, related_name='logs')), + ('message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mailer.Message', editable=False, related_name='logs')), ], ), ] diff --git a/orchestra/contrib/miscellaneous/migrations/0001_initial.py b/orchestra/contrib/miscellaneous/migrations/0001_initial.py index 57f112e2..53b560e6 100644 --- a/orchestra/contrib/miscellaneous/migrations/0001_initial.py +++ b/orchestra/contrib/miscellaneous/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.core.validators from django.conf import settings import orchestra.models.fields @@ -22,7 +23,7 @@ class Migration(migrations.Migration): ('description', models.TextField(blank=True, verbose_name='description')), ('amount', models.PositiveIntegerField(default=1, verbose_name='amount')), ('is_active', models.BooleanField(default=True, help_text='Designates whether this service should be treated as active. Unselect this instead of deleting services.', verbose_name='active')), - ('account', models.ForeignKey(related_name='miscellaneous', verbose_name='account', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='miscellaneous', verbose_name='account', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name_plural': 'miscellaneous', @@ -43,6 +44,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='miscellaneous', name='service', - field=models.ForeignKey(related_name='instances', verbose_name='service', to='miscellaneous.MiscService'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='instances', verbose_name='service', to='miscellaneous.MiscService'), ), ] diff --git a/orchestra/contrib/orchestration/migrations/0001_initial.py b/orchestra/contrib/orchestration/migrations/0001_initial.py index 3431fdda..e14d15d9 100644 --- a/orchestra/contrib/orchestration/migrations/0001_initial.py +++ b/orchestra/contrib/orchestration/migrations/0001_initial.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import django.db.models.deletion from django.db import models, migrations import orchestra.models.fields @@ -38,8 +39,8 @@ class Migration(migrations.Migration): ('backend', models.CharField(max_length=256, verbose_name='backend')), ('action', models.CharField(max_length=64, verbose_name='action')), ('object_id', models.PositiveIntegerField()), - ('content_type', models.ForeignKey(to='contenttypes.ContentType')), - ('log', models.ForeignKey(related_name='operations', to='orchestration.BackendLog')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ('log', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='operations', to='orchestration.BackendLog')), ], options={ 'verbose_name_plural': 'Operations', @@ -68,12 +69,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='route', name='host', - field=models.ForeignKey(to='orchestration.Server', verbose_name='host'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orchestration.Server', verbose_name='host'), ), migrations.AddField( model_name='backendlog', name='server', - field=models.ForeignKey(related_name='execution_logs', to='orchestration.Server', verbose_name='server'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='execution_logs', to='orchestration.Server', verbose_name='server'), ), migrations.AlterUniqueTogether( name='route', diff --git a/orchestra/contrib/orders/migrations/0001_initial.py b/orchestra/contrib/orders/migrations/0001_initial.py index 7d4f9173..adc37bc1 100644 --- a/orchestra/contrib/orders/migrations/0001_initial.py +++ b/orchestra/contrib/orders/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone +import django.db.models.deletion from django.conf import settings @@ -38,9 +39,9 @@ class Migration(migrations.Migration): ('billed_until', models.DateField(blank=True, verbose_name='billed until', null=True)), ('ignore', models.BooleanField(default=False, verbose_name='ignore')), ('description', models.TextField(blank=True, verbose_name='description')), - ('account', models.ForeignKey(verbose_name='account', related_name='orders', to=settings.AUTH_USER_MODEL)), - ('content_type', models.ForeignKey(to='contenttypes.ContentType')), - ('service', models.ForeignKey(verbose_name='service', related_name='orders', to='services.Service')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='account', related_name='orders', to=settings.AUTH_USER_MODEL)), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='service', related_name='orders', to='services.Service')), ], options={ 'get_latest_by': 'id', @@ -49,6 +50,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='metricstorage', name='order', - field=models.ForeignKey(verbose_name='order', related_name='metrics', to='orders.Order'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='order', related_name='metrics', to='orders.Order'), ), ] diff --git a/orchestra/contrib/payments/migrations/0001_initial.py b/orchestra/contrib/payments/migrations/0001_initial.py index dce1ac84..d63a7988 100644 --- a/orchestra/contrib/payments/migrations/0001_initial.py +++ b/orchestra/contrib/payments/migrations/0001_initial.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import django.db.models.deletion from django.db import models, migrations import jsonfield.fields from django.conf import settings @@ -21,7 +22,7 @@ class Migration(migrations.Migration): ('method', models.CharField(choices=[('CreditCard', 'Credit card'), ('SEPADirectDebit', 'SEPA Direct Debit')], verbose_name='method', max_length=32)), ('data', jsonfield.fields.JSONField(verbose_name='data', default={})), ('is_active', models.BooleanField(verbose_name='active', default=True)), - ('account', models.ForeignKey(verbose_name='account', related_name='paymentsources', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='account', related_name='paymentsources', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -33,7 +34,7 @@ class Migration(migrations.Migration): ('currency', models.CharField(max_length=10, default='Eur')), ('created_at', models.DateTimeField(verbose_name='created', auto_now_add=True)), ('modified_at', models.DateTimeField(verbose_name='modified', auto_now=True)), - ('bill', models.ForeignKey(verbose_name='bill', related_name='transactions', to='bills.Bill')), + ('bill', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='bill', related_name='transactions', to='bills.Bill')), ], ), migrations.CreateModel( @@ -53,11 +54,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='transaction', name='process', - field=models.ForeignKey(verbose_name='process', null=True, blank=True, related_name='transactions', to='payments.TransactionProcess'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='process', null=True, blank=True, related_name='transactions', to='payments.TransactionProcess'), ), migrations.AddField( model_name='transaction', name='source', - field=models.ForeignKey(verbose_name='source', null=True, blank=True, related_name='transactions', to='payments.PaymentSource'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='source', null=True, blank=True, related_name='transactions', to='payments.PaymentSource'), ), ] diff --git a/orchestra/contrib/plans/migrations/0001_initial.py b/orchestra/contrib/plans/migrations/0001_initial.py index f7ec2ba2..b48f70b8 100644 --- a/orchestra/contrib/plans/migrations/0001_initial.py +++ b/orchestra/contrib/plans/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.core.validators from django.conf import settings @@ -18,7 +19,7 @@ class Migration(migrations.Migration): name='ContractedPlan', fields=[ ('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')), - ('account', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='plans', verbose_name='account')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, related_name='plans', verbose_name='account')), ], options={ 'verbose_name_plural': 'plans', @@ -42,14 +43,14 @@ class Migration(migrations.Migration): ('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')), ('quantity', models.PositiveIntegerField(help_text='See rate algorihm help text.', blank=True, verbose_name='quantity', null=True)), ('price', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='price')), - ('plan', models.ForeignKey(to='plans.Plan', related_name='rates', verbose_name='plan')), - ('service', models.ForeignKey(to='services.Service', related_name='rates', verbose_name='service')), + ('plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plans.Plan', related_name='rates', verbose_name='plan')), + ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='services.Service', related_name='rates', verbose_name='service')), ], ), migrations.AddField( model_name='contractedplan', name='plan', - field=models.ForeignKey(to='plans.Plan', related_name='contracts', verbose_name='plan'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plans.Plan', related_name='contracts', verbose_name='plan'), ), migrations.AlterUniqueTogether( name='rate', diff --git a/orchestra/contrib/plans/migrations/0002_auto_20160114_1713.py b/orchestra/contrib/plans/migrations/0002_auto_20160114_1713.py index f9a08d9f..58e2ea14 100644 --- a/orchestra/contrib/plans/migrations/0002_auto_20160114_1713.py +++ b/orchestra/contrib/plans/migrations/0002_auto_20160114_1713.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,6 +15,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='rate', name='plan', - field=models.ForeignKey(related_name='rates', to='plans.Plan', blank=True, null=True, verbose_name='plan'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rates', to='plans.Plan', blank=True, null=True, verbose_name='plan'), ), ] diff --git a/orchestra/contrib/resources/migrations/0001_initial.py b/orchestra/contrib/resources/migrations/0001_initial.py index 2496191e..ca718163 100644 --- a/orchestra/contrib/resources/migrations/0001_initial.py +++ b/orchestra/contrib/resources/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.contrib.resources.validators import orchestra.models.fields import django.utils.timezone @@ -24,7 +25,7 @@ class Migration(migrations.Migration): ('object_id', models.PositiveIntegerField(verbose_name='object id')), ('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='created')), ('value', models.DecimalField(decimal_places=2, max_digits=16, verbose_name='value')), - ('content_type', models.ForeignKey(verbose_name='content type', to='contenttypes.ContentType')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='content type', to='contenttypes.ContentType')), ], options={ 'get_latest_by': 'id', @@ -45,8 +46,8 @@ class Migration(migrations.Migration): ('disable_trigger', models.BooleanField(help_text='Disables monitors exeeded and recovery triggers', default=False, verbose_name='disable trigger')), ('monitors', orchestra.models.fields.MultiSelectField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic')], blank=True, help_text='Monitor backends used for monitoring this resource.', max_length=256, verbose_name='monitors')), ('is_active', models.BooleanField(default=True, verbose_name='active')), - ('content_type', models.ForeignKey(help_text='Model where this resource will be hooked.', to='contenttypes.ContentType')), - ('crontab', models.ForeignKey(help_text='Crontab for periodic execution. Leave it empty to disable periodic monitoring', to='djcelery.CrontabSchedule', verbose_name='crontab', blank=True, null=True)), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, help_text='Model where this resource will be hooked.', to='contenttypes.ContentType')), + ('crontab', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, help_text='Crontab for periodic execution. Leave it empty to disable periodic monitoring', to='djcelery.CrontabSchedule', verbose_name='crontab', blank=True, null=True)), ], ), migrations.CreateModel( @@ -57,8 +58,8 @@ class Migration(migrations.Migration): ('used', models.DecimalField(decimal_places=3, editable=False, max_digits=16, null=True, verbose_name='used')), ('updated_at', models.DateTimeField(editable=False, null=True, verbose_name='updated')), ('allocated', models.DecimalField(decimal_places=2, max_digits=8, blank=True, null=True, verbose_name='allocated')), - ('content_type', models.ForeignKey(verbose_name='content type', to='contenttypes.ContentType')), - ('resource', models.ForeignKey(related_name='dataset', to='resources.Resource', verbose_name='resource')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='content type', to='contenttypes.ContentType')), + ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dataset', to='resources.Resource', verbose_name='resource')), ], options={ 'verbose_name_plural': 'resource data', diff --git a/orchestra/contrib/saas/migrations/0001_initial.py b/orchestra/contrib/saas/migrations/0001_initial.py index 5ed402ed..94ff9390 100644 --- a/orchestra/contrib/saas/migrations/0001_initial.py +++ b/orchestra/contrib/saas/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import jsonfield.fields from django.conf import settings import orchestra.core.validators @@ -23,8 +24,8 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=64, validators=[orchestra.core.validators.validate_username], verbose_name='Name', help_text='Required. 64 characters or fewer. Letters, digits and ./-/_ only.')), ('is_active', models.BooleanField(help_text='Designates whether this service should be treated as active. ', verbose_name='active', default=True)), ('data', jsonfield.fields.JSONField(help_text='Extra information dependent of each service.', verbose_name='data', default={})), - ('account', models.ForeignKey(verbose_name='account', to=settings.AUTH_USER_MODEL, related_name='saas')), - ('database', models.ForeignKey(null=True, blank=True, to='databases.Database')), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='account', to=settings.AUTH_USER_MODEL, related_name='saas')), + ('database', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, null=True, blank=True, to='databases.Database')), ], options={ 'verbose_name_plural': 'SaaS', diff --git a/orchestra/contrib/services/migrations/0001_initial.py b/orchestra/contrib/services/migrations/0001_initial.py index f376f4e3..50f9d1d5 100644 --- a/orchestra/contrib/services/migrations/0001_initial.py +++ b/orchestra/contrib/services/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion class Migration(migrations.Migration): @@ -32,7 +33,7 @@ class Migration(migrations.Migration): ('rate_algorithm', models.CharField(default='MATCH_PRICE', help_text='Algorithm used to interprete the rating table.
  Match price: Only the rate with a) inmediate inferior metric and b) lower price is applied. Nominal price will be used when initial block is missing.
  Step price: All rates with a quantity lower than the metric are applied. Nominal price will be used when initial block is missing.', max_length=16, choices=[('MATCH_PRICE', 'Match price'), ('STEP_PRICE', 'Step price')], verbose_name='rate algorithm')), ('on_cancel', models.CharField(default='DISCOUNT', help_text='Defines the cancellation behaviour of this service.', max_length=16, choices=[('NOTHING', 'Nothing'), ('DISCOUNT', 'Discount'), ('COMPENSATE', 'Compensat'), ('REFUND', 'Refund')], verbose_name='on cancel')), ('payment_style', models.CharField(default='PREPAY', help_text='Designates whether this service should be paid after consumtion (postpay/on demand) or prepaid.', max_length=16, choices=[('PREPAY', 'Prepay'), ('POSTPAY', 'Postpay (on demand)')], verbose_name='payment style')), - ('content_type', models.ForeignKey(help_text='Content type of the related service objects.', to='contenttypes.ContentType', verbose_name='content type')), + ('content_type', models.ForeignKey(help_text='Content type of the related service objects.', on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='content type')), ], ), ] diff --git a/orchestra/contrib/systemusers/migrations/0002_auto_20150429_1413.py b/orchestra/contrib/systemusers/migrations/0002_auto_20150429_1413.py index d71721e9..663a7d9b 100644 --- a/orchestra/contrib/systemusers/migrations/0002_auto_20150429_1413.py +++ b/orchestra/contrib/systemusers/migrations/0002_auto_20150429_1413.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.core.validators from django.conf import settings @@ -17,7 +18,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='systemuser', name='account', - field=models.ForeignKey(related_name='systemusers', to=settings.AUTH_USER_MODEL, default=1, verbose_name='Account'), + field=models.ForeignKey(related_name='systemusers', to=settings.AUTH_USER_MODEL, default=1, on_delete=django.db.models.deletion.CASCADE, verbose_name='Account'), preserve_default=False, ), ] diff --git a/orchestra/contrib/vps/migrations/0001_initial.py b/orchestra/contrib/vps/migrations/0001_initial.py index 21a3638f..aa1e2133 100644 --- a/orchestra/contrib/vps/migrations/0001_initial.py +++ b/orchestra/contrib/vps/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.core.validators from django.conf import settings @@ -21,7 +22,7 @@ class Migration(migrations.Migration): ('type', models.CharField(choices=[('openvz', 'OpenVZ container')], verbose_name='type', default='openvz', max_length=64)), ('template', models.CharField(choices=[('debian7', 'Debian 7 - Wheezy')], verbose_name='template', default='debian7', max_length=64)), ('password', models.CharField(verbose_name='password', help_text='root password of this virtual machine', max_length=128)), - ('account', models.ForeignKey(verbose_name='Account', related_name='vpss', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='Account', related_name='vpss', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name': 'VPS', diff --git a/orchestra/contrib/webapps/migrations/0001_initial.py b/orchestra/contrib/webapps/migrations/0001_initial.py index 7f0c5087..54a329d5 100644 --- a/orchestra/contrib/webapps/migrations/0001_initial.py +++ b/orchestra/contrib/webapps/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion import orchestra.core.validators import jsonfield.fields from django.conf import settings @@ -21,7 +22,7 @@ class Migration(migrations.Migration): ('name', models.CharField(verbose_name='name', validators=[orchestra.core.validators.validate_name], help_text='The app will be installed in %(home)s/webapps/%(app_name)s', max_length=128)), ('type', models.CharField(verbose_name='type', max_length=32, choices=[('php', 'PHP'), ('python', 'Python'), ('static', 'Static'), ('symbolic-link', 'Symbolic link'), ('webalizer', 'Webalizer'), ('wordpress-php', 'WordPress')])), ('data', jsonfield.fields.JSONField(verbose_name='data', blank=True, help_text='Extra information dependent of each service.', default={})), - ('account', models.ForeignKey(verbose_name='Account', related_name='webapps', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='Account', related_name='webapps', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name': 'Web App', @@ -34,7 +35,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)), ('name', models.CharField(verbose_name='name', max_length=128, choices=[(None, '-------'), ('FileSystem', [('public-root', 'Public root')]), ('Process', [('timeout', 'Process timeout'), ('processes', 'Number of processes')]), ('PHP', [('enable_functions', 'Enable functions'), ('allow_url_include', 'Allow URL include'), ('allow_url_fopen', 'Allow URL fopen'), ('auto_append_file', 'Auto append file'), ('auto_prepend_file', 'Auto prepend file'), ('date.timezone', 'date.timezone'), ('default_socket_timeout', 'Default socket timeout'), ('display_errors', 'Display errors'), ('extension', 'Extension'), ('magic_quotes_gpc', 'Magic quotes GPC'), ('magic_quotes_runtime', 'Magic quotes runtime'), ('magic_quotes_sybase', 'Magic quotes sybase'), ('max_input_time', 'Max input time'), ('max_input_vars', 'Max input vars'), ('memory_limit', 'Memory limit'), ('mysql.connect_timeout', 'Mysql connect timeout'), ('output_buffering', 'Output buffering'), ('register_globals', 'Register globals'), ('post_max_size', 'Post max size'), ('sendmail_path', 'Sendmail path'), ('session.bug_compat_warn', 'Session bug compat warning'), ('session.auto_start', 'Session auto start'), ('safe_mode', 'Safe mode'), ('suhosin.post.max_vars', 'Suhosin POST max vars'), ('suhosin.get.max_vars', 'Suhosin GET max vars'), ('suhosin.request.max_vars', 'Suhosin request max vars'), ('suhosin.session.encrypt', 'Suhosin session encrypt'), ('suhosin.simulation', 'Suhosin simulation'), ('suhosin.executor.include.whitelist', 'Suhosin executor include whitelist'), ('upload_max_filesize', 'Upload max filesize'), ('zend_extension', 'Zend extension')])])), ('value', models.CharField(verbose_name='value', max_length=256)), - ('webapp', models.ForeignKey(verbose_name='Web application', related_name='options', to='webapps.WebApp')), + ('webapp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='Web application', related_name='options', to='webapps.WebApp')), ], options={ 'verbose_name': 'option', diff --git a/orchestra/contrib/websites/migrations/0001_initial.py b/orchestra/contrib/websites/migrations/0001_initial.py index 083875de..f58a4210 100644 --- a/orchestra/contrib/websites/migrations/0001_initial.py +++ b/orchestra/contrib/websites/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings +import django.db.models.deletion import orchestra.core.validators @@ -20,7 +21,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)), ('path', models.CharField(validators=[orchestra.core.validators.validate_url_path], verbose_name='path', max_length=256, blank=True)), - ('webapp', models.ForeignKey(verbose_name='web application', to='webapps.WebApp')), + ('webapp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='web application', to='webapps.WebApp')), ], ), migrations.CreateModel( @@ -30,7 +31,7 @@ class Migration(migrations.Migration): ('name', models.CharField(validators=[orchestra.core.validators.validate_name], verbose_name='name', max_length=128)), ('protocol', models.CharField(verbose_name='protocol', default='http', choices=[('http', 'HTTP'), ('https', 'HTTPS'), ('http/https', 'HTTP and HTTPS'), ('https-only', 'HTTPS only')], help_text='Select the protocol(s) for this website
HTTPS only performs a redirection from http to https.', max_length=16)), ('is_active', models.BooleanField(verbose_name='active', default=True)), - ('account', models.ForeignKey(related_name='websites', verbose_name='Account', to=settings.AUTH_USER_MODEL)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='websites', verbose_name='Account', to=settings.AUTH_USER_MODEL)), ('contents', models.ManyToManyField(through='websites.Content', to='webapps.WebApp')), ('domains', models.ManyToManyField(verbose_name='domains', related_name='websites', to='domains.Domain')), ], @@ -41,13 +42,13 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)), ('name', models.CharField(verbose_name='name', choices=[(None, '-------'), ('SSL', [('ssl-ca', 'SSL CA'), ('ssl-cert', 'SSL cert'), ('ssl-key', 'SSL key')]), ('HTTPD', [('redirect', 'Redirection'), ('proxy', 'Proxy'), ('error-document', 'ErrorDocumentRoot')]), ('ModSecurity', [('sec-rule-remove', 'SecRuleRemoveById'), ('sec-engine', 'SecRuleEngine Off')]), ('SaaS', [('wordpress-saas', 'WordPress SaaS'), ('dokuwiki-saas', 'DokuWiki SaaS'), ('drupal-saas', 'Drupdal SaaS')])], max_length=128)), ('value', models.CharField(verbose_name='value', max_length=256)), - ('website', models.ForeignKey(related_name='directives', verbose_name='web site', to='websites.Website')), + ('website', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='directives', verbose_name='web site', to='websites.Website')), ], ), migrations.AddField( model_name='content', name='website', - field=models.ForeignKey(verbose_name='web site', to='websites.Website'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='web site', to='websites.Website'), ), migrations.AlterUniqueTogether( name='website',