This commit is contained in:
Rehan Dalal 2017-11-14 06:18:46 -05:00
Родитель a4f4fb2075
Коммит 6ec4df5b1e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 410D198EEF339E0B
49 изменённых файлов: 615 добавлений и 1857 удалений

Просмотреть файл

@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-29 18:07
# flake8: noqa
from __future__ import unicode_literals
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import migrations, models
import django_countries.fields
import normandy.recipes.fields
class PercentField(models.FloatField):
default_validators = [MinValueValidator(0), MaxValueValidator(100)]
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Recipe',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('filename', models.CharField(max_length=255, unique=True)),
('content', models.TextField()),
('content_hash', models.CharField(max_length=255, unique=True)),
('enabled', models.BooleanField(default=False)),
('locale', normandy.recipes.fields.LocaleField(blank=True, choices=[('st', 'Southern Sotho'), ('de-AT', 'German (Austria)'), ('bg', 'Bulgarian'), ('bn-BD', 'Bengali (Bangladesh)'), ('ne-NP', 'Nepali'), ('br', 'Breton'), ('th', 'Thai'), ('te', 'Telugu'), ('es-MX', 'Spanish (Mexico)'), ('km', 'Khmer'), ('dsb', 'Lower Sorbian'), ('ee', 'Ewe'), ('bm', 'Bambara'), ('ga', 'Irish'), ('de', 'German'), ('sr', 'Serbian'), ('fur-IT', 'Friulian'), ('lv', 'Latvian'), ('mai', 'Maithili'), ('vi', 'Vietnamese'), ('ro', 'Romanian'), ('dbg', 'Debug Robot'), ('es-AR', 'Spanish (Argentina)'), ('is', 'Icelandic'), ('it', 'Italian'), ('da', 'Danish'), ('af', 'Afrikaans'), ('sa', 'Sanskrit'), ('hu', 'Hungarian'), ('ml', 'Malayalam'), ('en-AU', 'English (Australian)'), ('bn-IN', 'Bengali (India)'), ('ko', 'Korean'), ('id', 'Indonesian'), ('ta-LK', 'Tamil (Sri Lanka)'), ('bs', 'Bosnian'), ('lij', 'Ligurian'), ('hr', 'Croatian'), ('fa', 'Persian'), ('sr-Cyrl', 'Serbian'), ('lg', 'Luganda'), ('hi', 'Hindi'), ('nl', 'Dutch'), ('ak', 'Akan'), ('brx', 'Bodo'), ('hy-AM', 'Armenian'), ('et', 'Estonian'), ('kok', 'Konkani'), ('sr-Latn', 'Serbian'), ('mk', 'Macedonian'), ('ks', 'Kashmiri'), ('as', 'Assamese'), ('uz', 'Uzbek'), ('am-et', 'Amharic'), ('sah', 'Sakha'), ('ka', 'Georgian'), ('nn-NO', 'Norwegian (Nynorsk)'), ('gu-IN', 'Gujarati (India)'), ('uk', 'Ukrainian'), ('de-DE', 'German (Germany)'), ('ln', 'Lingala'), ('mg', 'Malagasy'), ('gn', 'Guarani'), ('hsb', 'Upper Sorbian'), ('ca-valencia', 'Catalan (Valencian)'), ('es-CL', 'Spanish (Chile)'), ('lo', 'Lao'), ('or', 'Oriya'), ('ku', 'Kurdish'), ('nr', 'Ndebele, South'), ('es-ES', 'Spanish (Spain)'), ('kk', 'Kazakh'), ('nb-NO', 'Norwegian (Bokmål)'), ('he', 'Hebrew'), ('ast', 'Asturian'), ('ca', 'Catalan'), ('si', 'Sinhala'), ('tt-RU', 'Tatar'), ('fy-NL', 'Frisian'), ('la', 'Latin'), ('az', 'Azerbaijani'), ('nso', 'Northern Sotho'), ('el', 'Greek'), ('fi', 'Finnish'), ('csb', 'Kashubian'), ('sw', 'Swahili'), ('en-GB', 'English (British)'), ('eo', 'Esperanto'), ('mn', 'Mongolian'), ('sq', 'Albanian'), ('sv-SE', 'Swedish'), ('ff', 'Fulah'), ('tr', 'Turkish'), ('be', 'Belarusian'), ('mi', 'Maori (Aotearoa)'), ('cak', 'Kaqchikel'), ('gd', 'Gaelic (Scotland)'), ('ja', 'Japanese'), ('en-US', 'English (US)'), ('en-ZA', 'English (South African)'), ('en-CA', 'English (Canadian)'), ('tn', 'Tswana'), ('sl', 'Slovenian'), ('ta', 'Tamil'), ('pl', 'Polish'), ('hi-IN', 'Hindi (India)'), ('de-CH', 'German (Switzerland)'), ('cy', 'Welsh'), ('xh', 'Xhosa'), ('my', 'Burmese'), ('son', 'Songhai'), ('zh-TW', 'Chinese (Traditional)'), ('wo', 'Wolof'), ('rm', 'Romansh'), ('rw', 'Kinyarwanda'), ('pt-BR', 'Portuguese (Brazilian)'), ('cs', 'Czech'), ('pt-PT', 'Portuguese (Portugal)'), ('ta-IN', 'Tamil (India)'), ('zh-CN', 'Chinese (Simplified)'), ('sat', 'Santali'), ('ar', 'Arabic'), ('ha', 'Hausa'), ('ja-JP-mac', 'Japanese'), ('ga-IE', 'Irish'), ('ms', 'Malay'), ('tl', 'Tagalog'), ('ss', 'Siswati'), ('gu', 'Gujarati'), ('lt', 'Lithuanian'), ('fj-FJ', 'Fijian'), ('yo', 'Yoruba'), ('kn', 'Kannada'), ('x-testing', 'Testing'), ('an', 'Aragonese'), ('ach', 'Acholi'), ('mr', 'Marathi'), ('oc', 'Occitan (Lengadocian)'), ('eu', 'Basque'), ('ru', 'Russian'), ('sk', 'Slovak'), ('pa-IN', 'Punjabi (India)'), ('ve', 'Venda'), ('gl', 'Galician'), ('tsz', 'Purépecha'), ('pa', 'Punjabi'), ('ts', 'Tsonga'), ('en-NZ', 'English (New Zealand)'), ('fr', 'French'), ('es', 'Spanish'), ('ig', 'Igbo'), ('zu', 'Zulu'), ('ur', 'Urdu')], default='', max_length=255)),
('country', django_countries.fields.CountryField(default=None, max_length=2, null=True)),
('start_time', models.DateTimeField(default=None, null=True)),
('end_time', models.DateTimeField(default=None, null=True)),
('sample_rate', PercentField(default=100)),
],
),
]

Просмотреть файл

@ -0,0 +1,615 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-11-10 02:40
from __future__ import unicode_literals
import datetime
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
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')]
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)),
('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)),
],
),
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)),
],
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',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.CharField(max_length=255, unique=True)),
('name', models.CharField(max_length=255)),
],
options={
'ordering': ('slug',),
},
),
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)),
],
options={
'ordering': ('name',),
},
),
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)),
('name', models.CharField(max_length=255)),
],
options={
'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',
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)),
],
),
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',)},
),
migrations.AddField(
model_name='action',
name='signature',
field=models.OneToOneField(blank=True, null=True, on_delete=deletion.CASCADE, related_name='action', to='recipes.Signature'),
),
migrations.AlterField(
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),
),
migrations.AddField(
model_name='reciperevision',
name='identicon_seed',
field=recipe_fields.IdenticonSeedField(blank=True, max_length=64, null=True),
),
migrations.AlterField(
model_name='reciperevision',
name='identicon_seed',
field=recipe_fields.IdenticonSeedField(max_length=64),
),
]

Просмотреть файл

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-31 19:52
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django_countries.fields
import normandy.recipes.fields
class Migration(migrations.Migration):
dependencies = [
('recipes', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='recipe',
name='content_hash',
field=normandy.recipes.fields.AutoHashField('content', unique=True),
),
migrations.AlterField(
model_name='recipe',
name='country',
field=django_countries.fields.CountryField(blank=True, default=None, max_length=2, null=True),
),
migrations.AlterField(
model_name='recipe',
name='end_time',
field=models.DateTimeField(blank=True, default=None, null=True),
),
migrations.AlterField(
model_name='recipe',
name='locale',
field=normandy.recipes.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),
),
migrations.AlterField(
model_name='recipe',
name='start_time',
field=models.DateTimeField(blank=True, default=None, null=True),
),
]

Просмотреть файл

@ -1,59 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-12 22:22
# flake8: noqa
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import normandy.recipes.fields
class Migration(migrations.Migration):
dependencies = [
('recipes', '0002_auto_20151231_1952'),
]
operations = [
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)),
('implementation', models.TextField()),
('implementation_hash', normandy.recipes.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', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recipes.Action')),
],
),
migrations.RenameField(
model_name='recipe',
old_name='filename',
new_name='name',
),
migrations.RemoveField(
model_name='recipe',
name='content',
),
migrations.RemoveField(
model_name='recipe',
name='content_hash',
),
migrations.AddField(
model_name='recipeaction',
name='recipe',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recipes.Recipe'),
),
migrations.AddField(
model_name='recipe',
name='actions',
field=models.ManyToManyField(related_name='recipes', through='recipes.RecipeAction', to='recipes.Action'),
),
]

Просмотреть файл

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-13 00:46
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import normandy.recipes.fields
class Migration(migrations.Migration):
dependencies = [
('recipes', '0002_auto_20151231_1952'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='count_limit',
field=models.PositiveIntegerField(default=None, null=True),
),
migrations.AlterField(
model_name='recipe',
name='locale',
field=normandy.recipes.fields.LocaleField(blank=True, choices=[('en-US', 'English (US)'), ('uz', 'Uzbek'), ('ga', 'Irish'), ('lv', 'Latvian'), ('brx', 'Bodo'), ('sat', 'Santali'), ('is', 'Icelandic'), ('he', 'Hebrew'), ('wo', 'Wolof'), ('ko', 'Korean'), ('ta-IN', 'Tamil (India)'), ('ta', 'Tamil'), ('ln', 'Lingala'), ('ga-IE', 'Irish'), ('ha', 'Hausa'), ('eo', 'Esperanto'), ('kk', 'Kazakh'), ('hy-AM', 'Armenian'), ('pt-PT', 'Portuguese (Portugal)'), ('ja', 'Japanese'), ('pa', 'Punjabi'), ('mk', 'Macedonian'), ('hi', 'Hindi'), ('mai', 'Maithili'), ('az', 'Azerbaijani'), ('lo', 'Lao'), ('xh', 'Xhosa'), ('sa', 'Sanskrit'), ('nl', 'Dutch'), ('fr', 'French'), ('cak', 'Kaqchikel'), ('ne-NP', 'Nepali'), ('fi', 'Finnish'), ('kn', 'Kannada'), ('nr', 'Ndebele, South'), ('bg', 'Bulgarian'), ('pt-BR', 'Portuguese (Brazilian)'), ('nso', 'Northern Sotho'), ('sl', 'Slovenian'), ('hi-IN', 'Hindi (India)'), ('ee', 'Ewe'), ('bn-BD', 'Bengali (Bangladesh)'), ('es-ES', 'Spanish (Spain)'), ('hr', 'Croatian'), ('ig', 'Igbo'), ('oc', 'Occitan (Lengadocian)'), ('mi', 'Maori (Aotearoa)'), ('gu-IN', 'Gujarati (India)'), ('ach', 'Acholi'), ('tn', 'Tswana'), ('ku', 'Kurdish'), ('cs', 'Czech'), ('sk', 'Slovak'), ('mr', 'Marathi'), ('sr-Latn', 'Serbian'), ('lij', 'Ligurian'), ('lg', 'Luganda'), ('bs', 'Bosnian'), ('de-CH', 'German (Switzerland)'), ('mn', 'Mongolian'), ('ss', 'Siswati'), ('ve', 'Venda'), ('ak', 'Akan'), ('ms', 'Malay'), ('csb', 'Kashubian'), ('et', 'Estonian'), ('en-NZ', 'English (New Zealand)'), ('ar', 'Arabic'), ('es', 'Spanish'), ('x-testing', 'Testing'), ('en-ZA', 'English (South African)'), ('son', 'Songhai'), ('ca', 'Catalan'), ('ml', 'Malayalam'), ('ru', 'Russian'), ('cy', 'Welsh'), ('gl', 'Galician'), ('be', 'Belarusian'), ('uk', 'Ukrainian'), ('sw', 'Swahili'), ('dsb', 'Lower Sorbian'), ('ff', 'Fulah'), ('eu', 'Basque'), ('hsb', 'Upper Sorbian'), ('de', 'German'), ('en-GB', 'English (British)'), ('sv-SE', 'Swedish'), ('hu', 'Hungarian'), ('te', 'Telugu'), ('or', 'Oriya'), ('nn-NO', 'Norwegian (Nynorsk)'), ('ast', 'Asturian'), ('nb-NO', 'Norwegian (Bokmål)'), ('lt', 'Lithuanian'), ('id', 'Indonesian'), ('it', 'Italian'), ('bn-IN', 'Bengali (India)'), ('gu', 'Gujarati'), ('rw', 'Kinyarwanda'), ('gn', 'Guarani'), ('th', 'Thai'), ('tsz', 'Purépecha'), ('en-AU', 'English (Australian)'), ('el', 'Greek'), ('tt-RU', 'Tatar'), ('zu', 'Zulu'), ('fy-NL', 'Frisian'), ('my', 'Burmese'), ('km', 'Khmer'), ('af', 'Afrikaans'), ('ka', 'Georgian'), ('tr', 'Turkish'), ('de-DE', 'German (Germany)'), ('ks', 'Kashmiri'), ('en-CA', 'English (Canadian)'), ('st', 'Southern Sotho'), ('ca-valencia', 'Catalan (Valencian)'), ('gd', 'Gaelic (Scotland)'), ('ro', 'Romanian'), ('br', 'Breton'), ('bm', 'Bambara'), ('pa-IN', 'Punjabi (India)'), ('am-et', 'Amharic'), ('sah', 'Sakha'), ('es-AR', 'Spanish (Argentina)'), ('ja-JP-mac', 'Japanese'), ('as', 'Assamese'), ('es-CL', 'Spanish (Chile)'), ('an', 'Aragonese'), ('sq', 'Albanian'), ('ts', 'Tsonga'), ('fa', 'Persian'), ('vi', 'Vietnamese'), ('de-AT', 'German (Austria)'), ('zh-TW', 'Chinese (Traditional)'), ('zh-CN', 'Chinese (Simplified)'), ('fj-FJ', 'Fijian'), ('sr', 'Serbian'), ('tl', 'Tagalog'), ('ta-LK', 'Tamil (Sri Lanka)'), ('mg', 'Malagasy'), ('yo', 'Yoruba'), ('ur', 'Urdu'), ('da', 'Danish'), ('la', 'Latin'), ('fur-IT', 'Friulian'), ('pl', 'Polish'), ('sr-Cyrl', 'Serbian'), ('si', 'Sinhala'), ('dbg', 'Debug Robot'), ('es-MX', 'Spanish (Mexico)'), ('rm', 'Romansh'), ('kok', 'Konkani')], default='', max_length=255),
),
]

Просмотреть файл

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-12 23:12
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import normandy.recipes.fields
class Migration(migrations.Migration):
dependencies = [
('recipes', '0003_auto_20160112_2222'),
]
operations = [
migrations.AlterModelOptions(
name='recipeaction',
options={'ordering': ['order']},
),
migrations.AddField(
model_name='recipeaction',
name='order',
field=models.PositiveIntegerField(db_index=True, default=0, editable=False),
),
]

Просмотреть файл

@ -1,28 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-13 01:13
# flake8: noqa
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import normandy.recipes.fields
class Migration(migrations.Migration):
dependencies = [
('recipes', '0004_auto_20160112_2312'),
]
operations = [
migrations.AlterField(
model_name='recipe',
name='actions',
field=models.ManyToManyField(through='recipes.RecipeAction', to='recipes.Action'),
),
migrations.AlterField(
model_name='recipeaction',
name='arguments',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict),
),
]

Просмотреть файл

@ -1,17 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-15 19:14
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('recipes', '0005_auto_20160113_0113'),
('recipes', '0003_auto_20160113_0046'),
]
operations = [
]

Просмотреть файл

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-20 00:03
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations
import normandy.recipes.fields
class Migration(migrations.Migration):
dependencies = [
('recipes', '0006_merge'),
]
operations = [
migrations.RemoveField(
model_name='recipe',
name='count_limit',
),
]

Просмотреть файл

@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-22 02:28
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0007_auto_20160120_0003'),
]
operations = [
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)),
],
options={
'ordering': ['code'],
},
),
migrations.RemoveField(
model_name='recipe',
name='locale',
),
]

Просмотреть файл

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-22 02:28
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recipes', '0008_auto_20160122_0228'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='locale',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='recipes.Locale'),
),
]

Просмотреть файл

@ -1,36 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-22 07:15
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import normandy.recipes.models
def action_implementation_filename(instance, filename):
return 'actions/{instance.name}.js'.format(instance=instance)
class Migration(migrations.Migration):
dependencies = [
('recipes', '0009_recipe_locale'),
]
operations = [
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),
),
]

Просмотреть файл

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-02 23:25
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0010_auto_20160122_0715'),
]
operations = [
migrations.AlterField(
model_name='action',
name='implementation_hash',
field=models.CharField(editable=False, max_length=40),
),
]

Просмотреть файл

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-04 20:55
# flake8: noqa
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('recipes', '0011_auto_20160202_2325'),
]
operations = [
migrations.AddField(
model_name='action',
name='arguments_schema',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict),
),
]

Просмотреть файл

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-04 21:55
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import normandy.recipes.validators
class Migration(migrations.Migration):
dependencies = [
('recipes', '0012_action_arguments_schema'),
]
operations = [
migrations.AlterField(
model_name='action',
name='arguments_schema',
field=models.TextField(default='{}', validators=[normandy.recipes.validators.validate_json]),
),
migrations.AlterField(
model_name='recipeaction',
name='arguments',
field=models.TextField(default='{}', validators=[normandy.recipes.validators.validate_json]),
),
]

Просмотреть файл

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-04 23:37
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('recipes', '0013_auto_20160204_2155'),
]
operations = [
migrations.RenameField(
model_name='action',
old_name='arguments_schema',
new_name='arguments_schema_json',
),
migrations.RenameField(
model_name='recipeaction',
old_name='arguments',
new_name='arguments_json',
),
]

Просмотреть файл

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-17 18:19
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0014_auto_20160204_2337'),
]
operations = [
migrations.AlterField(
model_name='action',
name='implementation',
field=models.TextField(),
),
]

Просмотреть файл

@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-19 01:01
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0015_auto_20160217_1819'),
]
operations = [
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'),
),
]

Просмотреть файл

@ -1,56 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-18 20:24
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0016_auto_20160219_0101'),
]
operations = [
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.AddField(
model_name='locale',
name='order',
field=models.IntegerField(default=100),
preserve_default=False,
),
migrations.RemoveField(
model_name='recipe',
name='country',
),
migrations.RemoveField(
model_name='recipe',
name='locale',
),
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']},
),
]

Просмотреть файл

@ -1,53 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-18 19:03
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations
from django_countries import countries
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
class Migration(migrations.Migration):
dependencies = [
('recipes', '0017_auto_20160218_2024'),
]
operations = [
migrations.RunPython(add_countries, remove_countries),
migrations.RunPython(set_locale_sort_order, noop),
]

Просмотреть файл

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-16 22:50
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0018_countries'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='revision_id',
field=models.IntegerField(default=0, editable=False),
),
]

Просмотреть файл

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-16 19:47
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import normandy.recipes.validators
class Migration(migrations.Migration):
dependencies = [
('recipes', '0019_add_revision_id'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='action',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='recipes.Action'),
),
migrations.AddField(
model_name='recipe',
name='arguments_json',
field=models.TextField(default='{}', validators=[normandy.recipes.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'),
),
]

Просмотреть файл

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-16 19:55
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations
def multiple_to_single(apps, schema_editor):
"""
Take the first action in a recipe and set it as the single action.
"""
Recipe = apps.get_model('recipes', 'Recipe')
for recipe in Recipe.objects.all():
if recipe.recipeaction_set.count() < 1:
raise ValueError('Cannot migrate recipe pk={0} as it has no actions. Delete it manually'
' or add an action and re-run this migration.'.format(recipe.pk))
recipe_action = recipe.recipeaction_set.order_by('order')[0]
recipe.action = recipe_action.action
recipe.arguments_json = recipe_action.arguments_json
recipe.save()
def noop(apps, schema_editor):
pass # Not too concerned about going backwards here.
class Migration(migrations.Migration):
dependencies = [
('recipes', '0020_auto_20160316_1947'),
]
operations = [
migrations.RunPython(multiple_to_single, noop)
]

Просмотреть файл

@ -1,37 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-17 00:08
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recipes', '0021_migrate_to_single_actions'),
]
operations = [
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=django.db.models.deletion.CASCADE, to='recipes.Action'),
),
migrations.DeleteModel(
name='RecipeAction',
),
]

Просмотреть файл

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-24 23:33
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
def percent_to_float(apps, schema_editor):
"""Convert from percent to float"""
Recipe = apps.get_model('recipes', 'Recipe')
for recipe in Recipe.objects.all():
recipe.sample_rate /= 100
recipe.save()
def float_to_percent(apps, schema_editor):
"""Convert from percent to float"""
Recipe = apps.get_model('recipes', 'Recipe')
for recipe in Recipe.objects.all():
recipe.sample_rate *= 100
recipe.save()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0022_auto_20160317_0008'),
]
operations = [
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.RunPython(percent_to_float, float_to_percent),
]

Просмотреть файл

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-30 00:00
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0023_auto_20160324_2333'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='filter_expression',
field=models.TextField(default='true'),
preserve_default=False,
),
]

Просмотреть файл

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-29 23:57
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('recipes', '0024_recipe_filter_expression'),
]
operations = [
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',
),
]

Просмотреть файл

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-02 18:36
# flake8: noqa
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('recipes', '0025_auto_20160429_2357'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='approver',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]

Просмотреть файл

@ -1,65 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-09 22:25
# flake8: noqa
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('recipes', '0026_recipe_approver'),
]
operations = [
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=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_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=django.db.models.deletion.CASCADE, related_name='approval_request', to='recipes.Approval')),
('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, 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=datetime.datetime.now)),
('text', models.TextField()),
('approval_request', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='recipes.ApprovalRequest')),
('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.RemoveField(
model_name='recipe',
name='approver',
),
migrations.AddField(
model_name='approvalrequest',
name='recipe',
field=models.ForeignKey(on_delete=django.db.models.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=django.db.models.deletion.CASCADE, related_name='recipe', to='recipes.Approval'),
),
]

Просмотреть файл

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-24 17:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('recipes', '0027_auto_20160509_2225'),
]
operations = [
migrations.AlterField(
model_name='approval',
name='created',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='approvalrequest',
name='created',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='approvalrequestcomment',
name='created',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

Просмотреть файл

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-09 19:23
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('recipes', '0028_auto_20160524_1756'),
]
operations = [
migrations.AlterModelOptions(
name='recipe',
options={'ordering': ['-enabled', '-last_updated']},
),
migrations.AddField(
model_name='recipe',
name='last_updated',
field=models.DateTimeField(auto_now=True, default=django.utils.timezone.now),
preserve_default=False,
),
]

Просмотреть файл

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-16 21:54
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('recipes', '0029_recipe_last_updated'),
]
operations = [
migrations.DeleteModel(
name='Country',
),
migrations.DeleteModel(
name='Locale',
),
migrations.DeleteModel(
name='ReleaseChannel',
),
]

Просмотреть файл

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-09 17:48
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('recipes', '0030_auto_20160816_2154'),
]
operations = [
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)),
('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=django.db.models.deletion.CASCADE,
related_name='recipe', to='recipes.Signature'),
),
]

Просмотреть файл

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-27 21:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('recipes', '0031_recipe_signing'),
]
operations = [
migrations.AlterField(
model_name='recipe',
name='last_updated',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

Просмотреть файл

@ -1,88 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-10-14 23:38
from __future__ import unicode_literals
import json
from django.db import migrations
def split_recipes(apps, schema_editor):
"""
Split each show-heartbeat recipe into multiple recipes: one for each
survey configured in the recipe's arguments.
"""
Recipe = apps.get_model('recipes', 'Recipe')
heartbeat_recipes = Recipe.objects.filter(action__name='show-heartbeat')
for recipe in heartbeat_recipes:
# Delete the original, and use it as a template for new recipes.
recipe.delete()
recipe.enabled = False
recipe.signature = None
recipe_name = recipe.name
arguments = json.loads(recipe.arguments_json)
defaults = arguments.get('defaults', {})
for survey in arguments['surveys']:
recipe.pk = None
recipe.name = recipe_name
if survey.get('title'):
recipe.name += ' - ' + survey.get('title')
def _surveyAttr(name):
return survey.get(name) or defaults.get(name, '')
recipe.arguments_json = json.dumps({
'surveyId': arguments['surveyId'],
'message': _surveyAttr('message'),
'engagementButtonLabel': _surveyAttr('engagementButtonLabel'),
'thanksMessage': _surveyAttr('thanksMessage'),
'postAnswerUrl': _surveyAttr('postAnswerUrl'),
'learnMoreMessage': _surveyAttr('learnMoreMessage'),
'learnMoreUrl': _surveyAttr('learnMoreUrl'),
})
recipe.save()
def unsplit_recipes(apps, schema_editor):
"""
Convert split recipes back into unsplit ones. This does not
recombine recipes that were previously combined, it just reformats
their arguments to be valid to the old schema.
"""
Recipe = apps.get_model('recipes', 'Recipe')
heartbeat_recipes = Recipe.objects.filter(action__name='show-heartbeat')
for recipe in heartbeat_recipes:
arguments = json.loads(recipe.arguments_json)
recipe.arguments_json = json.dumps({
'surveyId': arguments['surveyId'],
'defaults': {
'message': arguments.get('message', ''),
'engagementButtonLabel': arguments.get('engagementButtonLabel', ''),
'thanksMessage': arguments.get('thanksMessage', ''),
'postAnswerUrl': arguments.get('postAnswerUrl', ''),
'learnMoreMessage': arguments.get('learnMoreMessage', ''),
'learnMoreUrl': arguments.get('learnMoreUrl', ''),
},
'surveys': [{
# Avoid stacking the names if we migrate back-and-forth
'title': '',
'weight': 1,
}],
})
recipe.save()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0032_remove_auto_now'),
]
operations = [
migrations.RunPython(split_recipes, unsplit_recipes),
]

Просмотреть файл

@ -1,101 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-28 13:41
# flake8: noqa
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import normandy.recipes.validators
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('recipes', '0033_migrate_surveys'),
]
operations = [
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])),
('filter_expression', models.TextField()),
('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='recipe_revisions', to='recipes.Action')),
('parent', models.OneToOneField(null=True, on_delete=django.db.models.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=django.db.models.deletion.CASCADE, related_name='revisions', to='recipes.Recipe'),
),
migrations.AddField(
model_name='reciperevision',
name='user',
field=models.ForeignKey(null=True, on_delete=django.db.models.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=django.db.models.deletion.SET_NULL, related_name='latest_for_recipe', to='recipes.RecipeRevision'),
),
migrations.AlterField(
model_name='recipe',
name='action',
field=models.ForeignKey(to='recipes.Action', null=True),
),
migrations.AlterField(
model_name='recipe',
name='name',
field=models.CharField(max_length=255, unique=False, null=True),
),
]

Просмотреть файл

@ -1,107 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-28 13:48
# flake8: noqa
from __future__ import unicode_literals
import hashlib
import json
from django.db import migrations
def hash_revision_data(revision):
data = '{}{}{}{}{}{}'.format(revision.recipe.id, revision.created, revision.name,
revision.action.id, revision.arguments_json,
revision.filter_expression)
return hashlib.sha256(data.encode()).hexdigest()
def migrate_reversion_data(apps, schema_editor):
Action = apps.get_model('recipes', 'Action')
Recipe = apps.get_model('recipes', 'Recipe')
RecipeRevision = apps.get_model('recipes', 'RecipeRevision')
Version = apps.get_model('reversion', 'Version')
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
ct = ContentType.objects.get(app_label='recipes', model='recipe')
except ContentType.DoesNotExist:
# There are no content types so there is no data to be migrated
pass
else:
for r in Recipe.objects.all():
revision = None
for v in Version.objects.filter(content_type=ct, object_id=r.id).order_by('revision__date_created'):
data = json.loads(v.serialized_data)[0]['fields']
action = Action.objects.get(id=data.get('action'))
revision = RecipeRevision(
recipe=r, parent=revision, created=v.revision.date_created,
comment=v.revision.comment, user=v.revision.user, name=data.get('name'),
action=action, arguments_json=data.get('arguments_json', ''),
filter_expression=data.get('filter_expression', ''))
revision.id = hash_revision_data(revision)
revision.save()
if revision is None:
revision = RecipeRevision(recipe=r, parent=None, name=r.name, action=r.action,
arguments_json=r.arguments_json,
filter_expression=r.filter_expression)
revision.id = hash_revision_data(revision)
revision.save()
r.latest_revision = revision
r.save()
def reverse_migrate_reversion_data(apps, schema_editor):
Action = apps.get_model('recipes', 'Action')
Recipe = apps.get_model('recipes', 'Recipe')
Version = apps.get_model('reversion', 'Version')
ContentType = apps.get_model('contenttypes', 'ContentType')
ct = ContentType.objects.get(app_label='recipes', model='recipe')
for r in Recipe.objects.all():
rev = r.latest_revision
if rev:
r.name = rev.name
r.arguments_json = rev.arguments_json
r.filter_expression = rev.filter_expression
r.action = rev.action
else:
v = Version.objects.filter(content_type=ct, object_id=r.id).order_by('-revision__date_created').first()
if v:
data = json.loads(v.serialized_data)[0]['fields']
try:
r.action = Action.objects.get(id=data.get('action'))
except Action.DoesNotExist:
r.action = Action.objects.first()
r.name = data.get('name', 'recipe-{}'.format(r.id))
r.arguments_json = data.get('arguments_json', '')
r.filter_expression = data.get('filter_expression', '')
r.save()
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '__latest__'),
('reversion', '__latest__'),
('recipes', '0034_recipe_revisions'),
]
operations = [
migrations.RunPython(migrate_reversion_data, reverse_migrate_reversion_data),
]

Просмотреть файл

@ -1,52 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-28 16:14
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recipes', '0035_revision_data'),
]
operations = [
migrations.RemoveField(
model_name='recipe',
name='action',
),
migrations.RemoveField(
model_name='recipe',
name='arguments_json',
),
migrations.AlterField(
model_name='recipe',
name='filter_expression',
field=models.TextField(blank=False, default=''),
preserve_default=True,
),
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=django.db.models.deletion.CASCADE, related_name='recipe_revision', to='recipes.Signature'),
),
]

Просмотреть файл

@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-01-13 06:27
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recipes', '0036_remove_old_recipe_fields'),
]
operations = [
migrations.CreateModel(
name='Channel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.CharField(max_length=255, unique=True)),
('name', models.CharField(max_length=255)),
],
options={
'ordering': ('slug',),
},
),
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)),
],
options={
'ordering': ('name',),
},
),
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)),
('name', models.CharField(max_length=255)),
],
options={
'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=django.db.models.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'),
),
]

Просмотреть файл

@ -1,41 +0,0 @@
"""
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything in a migration, and allow the
normal processes to regenerate the signatures.
"""
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-01-27 00:03
from __future__ import unicode_literals
from django.db import migrations
def remove_signatures(apps, schema_editor):
Recipe = apps.get_model('recipes', 'Recipe')
Signature = apps.get_model('recipes', 'Signature')
for recipe in Recipe.objects.exclude(signature=None):
sig = recipe.signature
recipe.signature = None
recipe.save()
sig.delete()
for sig in Signature.objects.all():
sig.delete()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0037_auto_20170113_0627'),
]
operations = [
# This function as both a forward and reverse migration
migrations.RunPython(remove_signatures, remove_signatures),
]

Просмотреть файл

@ -1,36 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-01-23 20:22
# flake8: noqa
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('recipes', '0038_remove_invalid_signatures'),
]
operations = [
migrations.CreateModel(
name='ApprovalRequest',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(default=django.utils.timezone.now)),
('approved', models.NullBooleanField()),
('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)),
('revision', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='approval_request', to='recipes.RecipeRevision')),
],
),
migrations.AddField(
model_name='recipe',
name='approved_revision',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_for_recipe', to='recipes.RecipeRevision'),
),
]

Просмотреть файл

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-02-09 08:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0039_approval_requests'),
]
operations = [
migrations.AddField(
model_name='approvalrequest',
name='comment',
field=models.TextField(null=True),
),
]

Просмотреть файл

@ -1,40 +0,0 @@
"""
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything in a migration, and allow the
normal processes to regenerate the signatures.
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def remove_signatures(apps, schema_editor):
Recipe = apps.get_model('recipes', 'Recipe')
Signature = apps.get_model('recipes', 'Signature')
for recipe in Recipe.objects.exclude(signature=None):
sig = recipe.signature
recipe.signature = None
recipe.save()
sig.delete()
for sig in Signature.objects.all():
sig.delete()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0040_approvalrequest_comment'),
]
operations = [
# This function as both a forward and reverse migration
migrations.RunPython(remove_signatures, remove_signatures),
]

Просмотреть файл

@ -1,40 +0,0 @@
"""
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything in a migration, and allow the
normal processes to regenerate the signatures.
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def remove_signatures(apps, schema_editor):
Recipe = apps.get_model('recipes', 'Recipe')
Signature = apps.get_model('recipes', 'Signature')
for recipe in Recipe.objects.exclude(signature=None):
sig = recipe.signature
recipe.signature = None
recipe.save()
sig.delete()
for sig in Signature.objects.all():
sig.delete()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0041_remove_invalid_signatures'),
]
operations = [
# This function as both a forward and reverse migration
migrations.RunPython(remove_signatures, remove_signatures),
]

Просмотреть файл

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-27 16:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recipes', '0042_remove_invalid_signatures'),
]
operations = [
migrations.AlterModelOptions(
name='reciperevision',
options={'ordering': ('-created',)},
),
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'
),
),
migrations.AlterField(
model_name='recipe',
name='signature',
field=models.OneToOneField(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name='recipe',
to='recipes.Signature'
),
),
]

Просмотреть файл

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-01 00:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0043_auto_20170727_1634'),
]
operations = [
migrations.AlterField(
model_name='action',
name='implementation_hash',
field=models.CharField(editable=False, max_length=71),
),
]

Просмотреть файл

@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
from base64 import urlsafe_b64encode
from django.db import migrations
def make_hashes_urlsafe_sri(apps, schema_editor):
Action = apps.get_model('recipes', 'Action')
for action in Action.objects.all():
data = action.implementation.encode()
digest = hashlib.sha384(data).digest()
data_hash = urlsafe_b64encode(digest)
action.implementation_hash = 'sha384-' + data_hash.decode()
action.save()
def make_hashes_sha1(apps, schema_editor):
Action = apps.get_model('recipes', 'Action')
for action in Action.objects.all():
data = action.implementation.encode()
data_hash = hashlib.sha1(data).hexdigest()
action.implementation_hash = data_hash
action.save()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0044_auto_20170801_0010'),
]
operations = [
migrations.RunPython(make_hashes_urlsafe_sri, make_hashes_sha1),
]

Просмотреть файл

@ -1,47 +0,0 @@
"""
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything in a migration, and allow the
normal processes to regenerate the signatures.
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def remove_signatures(apps, schema_editor):
Recipe = apps.get_model('recipes', 'Recipe')
Action = apps.get_model('recipes', 'Action')
Signature = apps.get_model('recipes', 'Signature')
for recipe in Recipe.objects.exclude(signature=None):
sig = recipe.signature
recipe.signature = None
recipe.save()
sig.delete()
for action in Action.objects.exclude(signature=None):
sig = action.signature
action.signature = None
action.save()
sig.delete()
for sig in Signature.objects.all():
sig.delete()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0045_update_action_hashes'),
]
operations = [
# This function as both a forward and reverse migration
migrations.RunPython(remove_signatures, remove_signatures),
]

Просмотреть файл

@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-16 23:58
from __future__ import unicode_literals
from django.db import migrations
import normandy.recipes.fields
def generate_identicon_seeds(apps, schema_editor):
RecipeRevision = apps.get_model('recipes', 'RecipeRevision')
for recipe_revision in RecipeRevision.objects.filter(identicon_seed=None):
recipe_revision.identicon_seed = f'v1:{recipe_revision.recipe.id}'
recipe_revision.save()
class Migration(migrations.Migration):
dependencies = [
('recipes', '0046_reset_signatures'),
]
operations = [
migrations.AddField(
model_name='reciperevision',
name='identicon_seed',
field=normandy.recipes.fields.IdenticonSeedField(blank=True, null=True, max_length=64),
),
migrations.RunPython(generate_identicon_seeds),
migrations.AlterField(
model_name='reciperevision',
name='identicon_seed',
field=normandy.recipes.fields.IdenticonSeedField(
blank=False,
null=False,
max_length=64,
),
),
]