зеркало из https://github.com/mozilla/normandy.git
Clean up squashed migration
This commit is contained in:
Родитель
6ec4df5b1e
Коммит
f0705540f1
|
@ -1,512 +1,74 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-11-10 02:40
|
||||
# Generated by Django 1.10.7 on 2017-11-16 17:30
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
|
||||
import dirtyfields.dirtyfields
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import jsonb
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
from django.db import migrations, models
|
||||
from django.db.models import deletion
|
||||
from django.utils import timezone
|
||||
from django_countries import countries, fields as countries_fields
|
||||
|
||||
from normandy.recipes import fields as recipe_fields
|
||||
from normandy.recipes import validators as recipe_validators
|
||||
|
||||
|
||||
class PercentField(models.FloatField):
|
||||
default_validators = [MinValueValidator(0), MaxValueValidator(100)]
|
||||
|
||||
|
||||
def action_implementation_filename(instance, filename):
|
||||
return 'actions/{instance.name}.js'.format(instance=instance)
|
||||
|
||||
|
||||
def add_countries(apps, schema_editor):
|
||||
Country = apps.get_model('recipes', 'Country')
|
||||
for (code, name) in countries:
|
||||
if code == 'US':
|
||||
order = 0
|
||||
else:
|
||||
order = 100
|
||||
|
||||
Country.objects.update_or_create(code=code, defaults={
|
||||
'name': name,
|
||||
'order': order,
|
||||
})
|
||||
|
||||
|
||||
def remove_countries(apps, schema_editor):
|
||||
Country = apps.get_model('recipes', 'Country')
|
||||
Country.objects.all().delete()
|
||||
|
||||
|
||||
def set_locale_sort_order(apps, schema_editor):
|
||||
Locale = apps.get_model('recipes', 'Locale')
|
||||
try:
|
||||
english = Locale.objects.get(code='en-US')
|
||||
english.order = 0
|
||||
english.save()
|
||||
except Locale.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
def noop(apps, schema_editor):
|
||||
pass
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import normandy.recipes.fields
|
||||
import normandy.recipes.validators
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
replaces = [('recipes', '0001_initial'), ('recipes', '0002_auto_20151231_1952'), ('recipes', '0003_auto_20160112_2222'), ('recipes', '0004_auto_20160112_2312'), ('recipes', '0005_auto_20160113_0113'), ('recipes', '0003_auto_20160113_0046'), ('recipes', '0006_merge'), ('recipes', '0007_auto_20160120_0003'), ('recipes', '0008_auto_20160122_0228'), ('recipes', '0009_recipe_locale'), ('recipes', '0010_auto_20160122_0715'), ('recipes', '0011_auto_20160202_2325'), ('recipes', '0012_action_arguments_schema'), ('recipes', '0013_auto_20160204_2155'), ('recipes', '0014_auto_20160204_2337'), ('recipes', '0015_auto_20160217_1819'), ('recipes', '0016_auto_20160219_0101'), ('recipes', '0017_auto_20160218_2024'), ('recipes', '0018_countries'), ('recipes', '0019_add_revision_id'), ('recipes', '0020_auto_20160316_1947'), ('recipes', '0021_migrate_to_single_actions'), ('recipes', '0022_auto_20160317_0008'), ('recipes', '0023_auto_20160324_2333'), ('recipes', '0024_recipe_filter_expression'), ('recipes', '0025_auto_20160429_2357'), ('recipes', '0026_recipe_approver'), ('recipes', '0027_auto_20160509_2225'), ('recipes', '0028_auto_20160524_1756'), ('recipes', '0029_recipe_last_updated'), ('recipes', '0030_auto_20160816_2154'), ('recipes', '0031_recipe_signing'), ('recipes', '0032_remove_auto_now'), ('recipes', '0033_migrate_surveys'), ('recipes', '0034_recipe_revisions'), ('recipes', '0035_revision_data'), ('recipes', '0036_remove_old_recipe_fields'), ('recipes', '0037_auto_20170113_0627'), ('recipes', '0038_remove_invalid_signatures'), ('recipes', '0039_approval_requests'), ('recipes', '0040_approvalrequest_comment'), ('recipes', '0041_remove_invalid_signatures'), ('recipes', '0042_remove_invalid_signatures'), ('recipes', '0043_auto_20170727_1634'), ('recipes', '0044_auto_20170801_0010'), ('recipes', '0045_update_action_hashes'), ('recipes', '0046_reset_signatures'), ('recipes', '0047_reciperevision_identicon_seed')]
|
||||
replaces = [('recipes', '0001_initial'), ('recipes', '0002_auto_20151231_1952'),
|
||||
('recipes', '0003_auto_20160112_2222'), ('recipes', '0004_auto_20160112_2312'),
|
||||
('recipes', '0005_auto_20160113_0113'), ('recipes', '0003_auto_20160113_0046'),
|
||||
('recipes', '0006_merge'), ('recipes', '0007_auto_20160120_0003'),
|
||||
('recipes', '0008_auto_20160122_0228'), ('recipes', '0009_recipe_locale'),
|
||||
('recipes', '0010_auto_20160122_0715'), ('recipes', '0011_auto_20160202_2325'),
|
||||
('recipes', '0012_action_arguments_schema'),
|
||||
('recipes', '0013_auto_20160204_2155'), ('recipes', '0014_auto_20160204_2337'),
|
||||
('recipes', '0015_auto_20160217_1819'), ('recipes', '0016_auto_20160219_0101'),
|
||||
('recipes', '0017_auto_20160218_2024'), ('recipes', '0018_countries'),
|
||||
('recipes', '0019_add_revision_id'), ('recipes', '0020_auto_20160316_1947'),
|
||||
('recipes', '0021_migrate_to_single_actions'),
|
||||
('recipes', '0022_auto_20160317_0008'), ('recipes', '0023_auto_20160324_2333'),
|
||||
('recipes', '0024_recipe_filter_expression'),
|
||||
('recipes', '0025_auto_20160429_2357'), ('recipes', '0026_recipe_approver'),
|
||||
('recipes', '0027_auto_20160509_2225'), ('recipes', '0028_auto_20160524_1756'),
|
||||
('recipes', '0029_recipe_last_updated'), ('recipes', '0030_auto_20160816_2154'),
|
||||
('recipes', '0031_recipe_signing'), ('recipes', '0032_remove_auto_now'),
|
||||
('recipes', '0033_migrate_surveys'), ('recipes', '0034_recipe_revisions'),
|
||||
('recipes', '0035_revision_data'), ('recipes', '0036_remove_old_recipe_fields'),
|
||||
('recipes', '0037_auto_20170113_0627'),
|
||||
('recipes', '0038_remove_invalid_signatures'),
|
||||
('recipes', '0039_approval_requests'), ('recipes', '0040_approvalrequest_comment'),
|
||||
('recipes', '0041_remove_invalid_signatures'),
|
||||
('recipes', '0042_remove_invalid_signatures'),
|
||||
('recipes', '0043_auto_20170727_1634'), ('recipes', '0044_auto_20170801_0010'),
|
||||
('recipes', '0045_update_action_hashes'), ('recipes', '0046_reset_signatures'),
|
||||
('recipes', '0047_reciperevision_identicon_seed')]
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '__latest__'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Recipe',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, unique=True)),
|
||||
('enabled', models.BooleanField(default=False)),
|
||||
('locale', recipe_fields.LocaleField(blank=True, choices=[('en-GB', 'English (British)'), ('mr', 'Marathi'), ('sq', 'Albanian'), ('fi', 'Finnish'), ('ml', 'Malayalam'), ('cy', 'Welsh'), ('mai', 'Maithili'), ('sv-SE', 'Swedish'), ('hy-AM', 'Armenian'), ('ur', 'Urdu'), ('lij', 'Ligurian'), ('am-et', 'Amharic'), ('ga-IE', 'Irish'), ('ee', 'Ewe'), ('eo', 'Esperanto'), ('brx', 'Bodo'), ('te', 'Telugu'), ('ts', 'Tsonga'), ('ro', 'Romanian'), ('zh-TW', 'Chinese (Traditional)'), ('is', 'Icelandic'), ('ta', 'Tamil'), ('bg', 'Bulgarian'), ('km', 'Khmer'), ('lv', 'Latvian'), ('ku', 'Kurdish'), ('de-AT', 'German (Austria)'), ('ast', 'Asturian'), ('gl', 'Galician'), ('as', 'Assamese'), ('hi', 'Hindi'), ('ca-valencia', 'Catalan (Valencian)'), ('ja', 'Japanese'), ('ja-JP-mac', 'Japanese'), ('gd', 'Gaelic (Scotland)'), ('fa', 'Persian'), ('en-AU', 'English (Australian)'), ('pt-BR', 'Portuguese (Brazilian)'), ('ta-LK', 'Tamil (Sri Lanka)'), ('nl', 'Dutch'), ('rm', 'Romansh'), ('el', 'Greek'), ('ka', 'Georgian'), ('cs', 'Czech'), ('ar', 'Arabic'), ('en-NZ', 'English (New Zealand)'), ('da', 'Danish'), ('ach', 'Acholi'), ('dbg', 'Debug Robot'), ('pa', 'Punjabi'), ('ig', 'Igbo'), ('fy-NL', 'Frisian'), ('cak', 'Kaqchikel'), ('sl', 'Slovenian'), ('bm', 'Bambara'), ('gu-IN', 'Gujarati (India)'), ('uz', 'Uzbek'), ('he', 'Hebrew'), ('an', 'Aragonese'), ('csb', 'Kashubian'), ('en-CA', 'English (Canadian)'), ('dsb', 'Lower Sorbian'), ('bn-BD', 'Bengali (Bangladesh)'), ('mg', 'Malagasy'), ('bs', 'Bosnian'), ('mi', 'Maori (Aotearoa)'), ('hsb', 'Upper Sorbian'), ('gu', 'Gujarati'), ('it', 'Italian'), ('oc', 'Occitan (Lengadocian)'), ('eu', 'Basque'), ('et', 'Estonian'), ('id', 'Indonesian'), ('en-ZA', 'English (South African)'), ('uk', 'Ukrainian'), ('pa-IN', 'Punjabi (India)'), ('ms', 'Malay'), ('pt-PT', 'Portuguese (Portugal)'), ('sr-Latn', 'Serbian'), ('nr', 'Ndebele, South'), ('kok', 'Konkani'), ('hi-IN', 'Hindi (India)'), ('de-CH', 'German (Switzerland)'), ('tt-RU', 'Tatar'), ('rw', 'Kinyarwanda'), ('fr', 'French'), ('lo', 'Lao'), ('nb-NO', 'Norwegian (Bokmål)'), ('ak', 'Akan'), ('es-CL', 'Spanish (Chile)'), ('de', 'German'), ('fj-FJ', 'Fijian'), ('bn-IN', 'Bengali (India)'), ('kn', 'Kannada'), ('en-US', 'English (US)'), ('gn', 'Guarani'), ('az', 'Azerbaijani'), ('fur-IT', 'Friulian'), ('zh-CN', 'Chinese (Simplified)'), ('la', 'Latin'), ('ha', 'Hausa'), ('x-testing', 'Testing'), ('si', 'Sinhala'), ('af', 'Afrikaans'), ('son', 'Songhai'), ('kk', 'Kazakh'), ('tl', 'Tagalog'), ('es', 'Spanish'), ('sw', 'Swahili'), ('es-AR', 'Spanish (Argentina)'), ('ru', 'Russian'), ('es-MX', 'Spanish (Mexico)'), ('xh', 'Xhosa'), ('nn-NO', 'Norwegian (Nynorsk)'), ('hu', 'Hungarian'), ('ne-NP', 'Nepali'), ('sat', 'Santali'), ('ta-IN', 'Tamil (India)'), ('lt', 'Lithuanian'), ('hr', 'Croatian'), ('sa', 'Sanskrit'), ('mn', 'Mongolian'), ('nso', 'Northern Sotho'), ('lg', 'Luganda'), ('my', 'Burmese'), ('be', 'Belarusian'), ('ln', 'Lingala'), ('sr-Cyrl', 'Serbian'), ('tr', 'Turkish'), ('mk', 'Macedonian'), ('sah', 'Sakha'), ('wo', 'Wolof'), ('de-DE', 'German (Germany)'), ('zu', 'Zulu'), ('ca', 'Catalan'), ('pl', 'Polish'), ('br', 'Breton'), ('tn', 'Tswana'), ('vi', 'Vietnamese'), ('es-ES', 'Spanish (Spain)'), ('ve', 'Venda'), ('ga', 'Irish'), ('tsz', 'Purépecha'), ('ss', 'Siswati'), ('ks', 'Kashmiri'), ('sk', 'Slovak'), ('sr', 'Serbian'), ('ff', 'Fulah'), ('st', 'Southern Sotho'), ('yo', 'Yoruba'), ('th', 'Thai'), ('ko', 'Korean'), ('or', 'Oriya')], default='', max_length=255)),
|
||||
('country', countries_fields.CountryField(blank=True, default=None, max_length=2, null=True)),
|
||||
('start_time', models.DateTimeField(blank=True, default=None, null=True)),
|
||||
('end_time', models.DateTimeField(blank=True, default=None, null=True)),
|
||||
('sample_rate', PercentField(default=100)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Action',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, unique=True)),
|
||||
('name', models.SlugField(max_length=255, unique=True)),
|
||||
('implementation', models.TextField()),
|
||||
('implementation_hash', recipe_fields.AutoHashField('implementation', unique=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='RecipeAction',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('arguments', jsonb.JSONField(default=dict)),
|
||||
('action', models.ForeignKey(on_delete=deletion.CASCADE, to='recipes.Action')),
|
||||
('recipe', models.ForeignKey(on_delete=deletion.CASCADE, to='recipes.Recipe')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='actions',
|
||||
field=models.ManyToManyField(through='recipes.RecipeAction', to='recipes.Action'),
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='recipeaction',
|
||||
options={'ordering': ['order']},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipeaction',
|
||||
name='order',
|
||||
field=models.PositiveIntegerField(db_index=True, default=0, editable=False),
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='recipeaction',
|
||||
old_name='arguments',
|
||||
new_name='arguments_json',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipeaction',
|
||||
name='arguments_json',
|
||||
field=jsonb.JSONField(blank=True, default=dict),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='locale',
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Locale',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('code', models.CharField(max_length=255, unique=True)),
|
||||
('english_name', models.CharField(blank=True, max_length=255)),
|
||||
('native_name', models.CharField(blank=True, max_length=255)),
|
||||
('order', models.IntegerField(default=100)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['code'],
|
||||
},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='action',
|
||||
name='implementation',
|
||||
field=models.FileField(upload_to=action_implementation_filename),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='action',
|
||||
name='implementation_hash',
|
||||
field=models.CharField(editable=False, max_length=40, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='action',
|
||||
name='name',
|
||||
field=models.SlugField(max_length=255, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='action',
|
||||
name='implementation_hash',
|
||||
field=models.CharField(editable=False, max_length=40),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='action',
|
||||
name='arguments_schema_json',
|
||||
field=models.TextField(default='{}', validators=[recipe_validators.validate_json]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipeaction',
|
||||
name='arguments_json',
|
||||
field=models.TextField(default='{}', validators=[recipe_validators.validate_json]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='action',
|
||||
name='implementation',
|
||||
field=models.TextField(),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ReleaseChannel',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('slug', models.SlugField(max_length=255, unique=True)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['slug'],
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='release_channels',
|
||||
field=models.ManyToManyField(blank=True, to='recipes.ReleaseChannel'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Country',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('code', models.CharField(max_length=255, unique=True)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('order', models.IntegerField()),
|
||||
],
|
||||
options={
|
||||
'ordering': ['order', 'name'],
|
||||
},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='country',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='locales',
|
||||
field=models.ManyToManyField(blank=True, to='recipes.Locale'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='countries',
|
||||
field=models.ManyToManyField(blank=True, to='recipes.Country'),
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='locale',
|
||||
options={'ordering': ['order', 'code']},
|
||||
),
|
||||
migrations.RunPython(
|
||||
code=add_countries,
|
||||
reverse_code=remove_countries,
|
||||
),
|
||||
migrations.RunPython(
|
||||
code=set_locale_sort_order,
|
||||
reverse_code=noop,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='revision_id',
|
||||
field=models.IntegerField(default=0, editable=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='action',
|
||||
field=models.ForeignKey(null=True, on_delete=deletion.CASCADE, to='recipes.Action'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='arguments_json',
|
||||
field=models.TextField(default='{}', validators=[recipe_validators.validate_json]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='country',
|
||||
name='order',
|
||||
field=models.IntegerField(default=100),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='locale',
|
||||
name='order',
|
||||
field=models.IntegerField(default=100),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='actions',
|
||||
field=models.ManyToManyField(related_name='recipes', through='recipes.RecipeAction', to='recipes.Action'),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipeaction',
|
||||
name='action',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipeaction',
|
||||
name='recipe',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='actions',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='action',
|
||||
field=models.ForeignKey(on_delete=deletion.CASCADE, to='recipes.Action'),
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='RecipeAction',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='sample_rate',
|
||||
field=models.FloatField(default=1.0, help_text='A number between 0.0 and 1.0. A value of 0.0 will select no users. A value of 1.0 will select all users'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='filter_expression',
|
||||
field=models.TextField(default='true'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='countries',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='end_time',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='locales',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='release_channels',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='sample_rate',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='start_time',
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Approval',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', models.DateTimeField(default=datetime.datetime.now)),
|
||||
('creator', models.ForeignKey(on_delete=deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
('implementation_hash', models.CharField(editable=False, max_length=71)),
|
||||
('arguments_schema_json', models.TextField(default='{}', validators=[normandy.recipes.validators.validate_json])),
|
||||
],
|
||||
bases=(dirtyfields.dirtyfields.DirtyFieldsMixin, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ApprovalRequest',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', models.DateTimeField(default=datetime.datetime.now)),
|
||||
('active', models.BooleanField(default=True)),
|
||||
('approval', models.OneToOneField(null=True, on_delete=deletion.CASCADE, related_name='approval_request', to='recipes.Approval')),
|
||||
('creator', models.ForeignKey(on_delete=deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
('created', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('approved', models.NullBooleanField()),
|
||||
('comment', models.TextField(null=True)),
|
||||
('approver', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_requests', to=settings.AUTH_USER_MODEL)),
|
||||
('creator', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approval_requests', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ('-created',),
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ApprovalRequestComment',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', models.DateTimeField(default=timezone.now)),
|
||||
('text', models.TextField()),
|
||||
('approval_request', models.ForeignKey(on_delete=deletion.CASCADE, related_name='comments', to='recipes.ApprovalRequest')),
|
||||
('creator', models.ForeignKey(on_delete=deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='approvalrequest',
|
||||
name='recipe',
|
||||
field=models.ForeignKey(on_delete=deletion.CASCADE, related_name='approval_requests', to='recipes.Recipe'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='approval',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=deletion.CASCADE, related_name='recipe', to='recipes.Approval'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='approval',
|
||||
name='created',
|
||||
field=models.DateTimeField(default=timezone.now),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='approvalrequest',
|
||||
name='created',
|
||||
field=models.DateTimeField(default=timezone.now),
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='recipe',
|
||||
options={'ordering': ['-enabled', '-last_updated']},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='last_updated',
|
||||
field=models.DateTimeField(default=timezone.now),
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Country',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Locale',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ReleaseChannel',
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Signature',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('signature', models.TextField()),
|
||||
('timestamp', models.DateTimeField(default=timezone.now)),
|
||||
('x5u', models.TextField(null=True)),
|
||||
('public_key', models.TextField()),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='signature',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=deletion.CASCADE, related_name='recipe', to='recipes.Signature'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='RecipeRevision',
|
||||
fields=[
|
||||
('id', models.CharField(max_length=64, primary_key=True, serialize=False)),
|
||||
('created', models.DateTimeField(default=timezone.now)),
|
||||
('updated', models.DateTimeField(default=timezone.now)),
|
||||
('comment', models.TextField()),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('arguments_json', models.TextField(default='{}', validators=[recipe_validators.validate_json])),
|
||||
('filter_expression', models.TextField()),
|
||||
('action', models.ForeignKey(on_delete=deletion.CASCADE, related_name='recipe_revisions', to='recipes.Action')),
|
||||
('parent', models.OneToOneField(null=True, on_delete=deletion.CASCADE, related_name='child', to='recipes.RecipeRevision')),
|
||||
],
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='approval',
|
||||
name='creator',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='approvalrequest',
|
||||
name='approval',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='approvalrequest',
|
||||
name='creator',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='approvalrequest',
|
||||
name='recipe',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='approvalrequestcomment',
|
||||
name='approval_request',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='approvalrequestcomment',
|
||||
name='creator',
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='recipe',
|
||||
options={'ordering': ['-enabled', '-latest_revision__updated']},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='approval',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Approval',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ApprovalRequest',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ApprovalRequestComment',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='reciperevision',
|
||||
name='recipe',
|
||||
field=models.ForeignKey(on_delete=deletion.CASCADE, related_name='revisions', to='recipes.Recipe'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='reciperevision',
|
||||
name='user',
|
||||
field=models.ForeignKey(null=True, on_delete=deletion.SET_NULL, related_name='recipe_revisions', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='latest_revision',
|
||||
field=models.ForeignKey(null=True, on_delete=deletion.SET_NULL, related_name='latest_for_recipe', to='recipes.RecipeRevision'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='action',
|
||||
field=models.ForeignKey(null=True, on_delete=deletion.CASCADE, to='recipes.Action'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='name',
|
||||
field=models.CharField(max_length=255, null=True),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='action',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='arguments_json',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='filter_expression',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='last_updated',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='name',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipe',
|
||||
name='revision_id',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='signature',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=deletion.CASCADE, related_name='recipe_revision', to='recipes.Signature'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Channel',
|
||||
|
@ -541,75 +103,73 @@ class Migration(migrations.Migration):
|
|||
'ordering': ('name',),
|
||||
},
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='reciperevision',
|
||||
old_name='filter_expression',
|
||||
new_name='extra_filter_expression',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='reciperevision',
|
||||
name='action',
|
||||
field=models.ForeignKey(on_delete=deletion.CASCADE, related_name='recipe_revisions', to='recipes.Action'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='reciperevision',
|
||||
name='channels',
|
||||
field=models.ManyToManyField(to='recipes.Channel'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='reciperevision',
|
||||
name='countries',
|
||||
field=models.ManyToManyField(to='recipes.Country'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='reciperevision',
|
||||
name='locales',
|
||||
field=models.ManyToManyField(to='recipes.Locale'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ApprovalRequest',
|
||||
name='Recipe',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', models.DateTimeField(default=timezone.now)),
|
||||
('approved', models.NullBooleanField()),
|
||||
('approver', models.ForeignKey(null=True, on_delete=deletion.SET_NULL, related_name='approved_requests', to=settings.AUTH_USER_MODEL)),
|
||||
('creator', models.ForeignKey(null=True, on_delete=deletion.SET_NULL, related_name='approval_requests', to=settings.AUTH_USER_MODEL)),
|
||||
('revision', models.OneToOneField(on_delete=deletion.CASCADE, related_name='approval_request', to='recipes.RecipeRevision')),
|
||||
('comment', models.TextField(null=True)),
|
||||
('enabled', models.BooleanField(default=False)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-enabled', '-latest_revision__updated'],
|
||||
},
|
||||
bases=(dirtyfields.dirtyfields.DirtyFieldsMixin, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='RecipeRevision',
|
||||
fields=[
|
||||
('id', models.CharField(max_length=64, primary_key=True, serialize=False)),
|
||||
('created', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('updated', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('comment', models.TextField()),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('arguments_json', models.TextField(default='{}', validators=[normandy.recipes.validators.validate_json])),
|
||||
('extra_filter_expression', models.TextField()),
|
||||
('identicon_seed', normandy.recipes.fields.IdenticonSeedField(max_length=64)),
|
||||
('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='recipe_revisions', to='recipes.Action')),
|
||||
('channels', models.ManyToManyField(to='recipes.Channel')),
|
||||
('countries', models.ManyToManyField(to='recipes.Country')),
|
||||
('locales', models.ManyToManyField(to='recipes.Locale')),
|
||||
('parent', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child', to='recipes.RecipeRevision')),
|
||||
('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='recipes.Recipe')),
|
||||
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='recipe_revisions', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ('-created',),
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Signature',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('signature', models.TextField()),
|
||||
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('public_key', models.TextField()),
|
||||
('x5u', models.TextField(null=True)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='approved_revision',
|
||||
field=models.ForeignKey(null=True, on_delete=deletion.SET_NULL, related_name='approved_for_recipe', to='recipes.RecipeRevision'),
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='reciperevision',
|
||||
options={'ordering': ('-created',)},
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_for_recipe', to='recipes.RecipeRevision'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='action',
|
||||
name='signature',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=deletion.CASCADE, related_name='action', to='recipes.Signature'),
|
||||
model_name='recipe',
|
||||
name='latest_revision',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='latest_for_recipe', to='recipes.RecipeRevision'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='signature',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=deletion.CASCADE, related_name='recipe', to='recipes.Signature'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='action',
|
||||
name='implementation_hash',
|
||||
field=models.CharField(editable=False, max_length=71),
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='recipe', to='recipes.Signature'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='reciperevision',
|
||||
name='identicon_seed',
|
||||
field=recipe_fields.IdenticonSeedField(blank=True, max_length=64, null=True),
|
||||
model_name='approvalrequest',
|
||||
name='revision',
|
||||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='approval_request', to='recipes.RecipeRevision'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='reciperevision',
|
||||
name='identicon_seed',
|
||||
field=recipe_fields.IdenticonSeedField(max_length=64),
|
||||
migrations.AddField(
|
||||
model_name='action',
|
||||
name='signature',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='action', to='recipes.Signature'),
|
||||
),
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче