Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10575: Allow black to format migrations + reformat #10578

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# Migrate Python imports using isort
ab38b080abbff26e6968ced9267f3c576bb9e5fa

# Allow Black to reformat migrations
329890d484ff62fc05d6ca764801f56a6baaf748
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on how this merges this may not be right after. Just something to keep an eye on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, it won't fly because it'll be a squashed commit. Will fix after merge

1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ exclude: >
| assets
| static
| bedrock/externalfiles/files_cache
| ^.*\b(migrations)\b.*$
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this allows pre-commit-driven checks to INCLUDE migrations after all, but changing it up here will also mean the scope of other tools will increase to include migrations. Can you see a reason not to allow this @robhudson ? I'm happy to rework this if it breaks any behaviour you wanted to retain :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that opens it up to flake8 as well which is good. The front-end checks may already filter by extension so that should be fine as well.

| git-repos
| lib/fluent_migrations
)
Expand Down
11 changes: 5 additions & 6 deletions bedrock/base/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ConfigValue',
name="ConfigValue",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=100, db_index=True)),
('value', models.CharField(max_length=200)),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("name", models.CharField(unique=True, max_length=100, db_index=True)),
("value", models.CharField(max_length=200)),
],
),
]
19 changes: 9 additions & 10 deletions bedrock/contentcards/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ContentCard',
name="ContentCard",
fields=[
('id', models.CharField(max_length=100, serialize=False, primary_key=True)),
('card_name', models.CharField(max_length=100)),
('page_name', models.CharField(max_length=100)),
('locale', models.CharField(max_length=10)),
('content', models.TextField(blank=True)),
('data', django_extensions.db.fields.json.JSONField()),
("id", models.CharField(max_length=100, serialize=False, primary_key=True)),
("card_name", models.CharField(max_length=100)),
("page_name", models.CharField(max_length=100)),
("locale", models.CharField(max_length=10)),
("content", models.TextField(blank=True)),
("data", django_extensions.db.fields.json.JSONField()),
],
options={
'ordering': ('id',),
"ordering": ("id",),
},
),
]
23 changes: 11 additions & 12 deletions bedrock/contentful/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ContentfulEntry',
name="ContentfulEntry",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('contentful_id', models.CharField(max_length=20, unique=True)),
('content_type', models.CharField(max_length=20)),
('language', models.CharField(max_length=5)),
('last_modified', models.DateTimeField(default=django.utils.timezone.now)),
('url_base', models.CharField(blank=True, max_length=255)),
('slug', models.CharField(blank=True, max_length=255)),
('data_hash', models.CharField(max_length=64)),
('data', django_extensions.db.fields.json.JSONField(default=dict)),
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("contentful_id", models.CharField(max_length=20, unique=True)),
("content_type", models.CharField(max_length=20)),
("language", models.CharField(max_length=5)),
("last_modified", models.DateTimeField(default=django.utils.timezone.now)),
("url_base", models.CharField(blank=True, max_length=255)),
("slug", models.CharField(blank=True, max_length=255)),
("data_hash", models.CharField(max_length=64)),
("data", django_extensions.db.fields.json.JSONField(default=dict)),
],
),
]
14 changes: 6 additions & 8 deletions bedrock/externalfiles/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ExternalFile',
name="ExternalFile",
fields=[
('name', models.CharField(max_length=50, serialize=False, primary_key=True)),
('content', models.TextField()),
('last_modified', models.DateTimeField(auto_now=True)),
("name", models.CharField(max_length=50, serialize=False, primary_key=True)),
("content", models.TextField()),
("last_modified", models.DateTimeField(auto_now=True)),
],
options={
},
options={},
bases=(models.Model,),
),
]
16 changes: 7 additions & 9 deletions bedrock/firefox/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='FirefoxOSFeedLink',
name="FirefoxOSFeedLink",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('link', models.URLField(max_length=2000)),
('title', models.CharField(max_length=2000)),
('locale', models.CharField(max_length=10, db_index=True)),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("link", models.URLField(max_length=2000)),
("title", models.CharField(max_length=2000)),
("locale", models.CharField(max_length=10, db_index=True)),
],
options={
},
options={},
bases=(models.Model,),
),
]
4 changes: 2 additions & 2 deletions bedrock/firefox/migrations/0002_delete_firefoxosfeedlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
class Migration(migrations.Migration):

dependencies = [
('firefox', '0001_initial'),
("firefox", "0001_initial"),
]

operations = [
migrations.DeleteModel(
name='FirefoxOSFeedLink',
name="FirefoxOSFeedLink",
),
]
13 changes: 6 additions & 7 deletions bedrock/legal_docs/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='LegalDoc',
name="LegalDoc",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('locale', models.CharField(max_length=5)),
('content', models.TextField()),
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=100)),
("locale", models.CharField(max_length=5)),
("content", models.TextField()),
],
),
]
38 changes: 18 additions & 20 deletions bedrock/mozorg/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,38 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ContributorActivity',
name="ContributorActivity",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateField()),
('source_name', models.CharField(max_length=100)),
('team_name', models.CharField(max_length=100)),
('total', models.IntegerField()),
('new', models.IntegerField()),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("date", models.DateField()),
("source_name", models.CharField(max_length=100)),
("team_name", models.CharField(max_length=100)),
("total", models.IntegerField()),
("new", models.IntegerField()),
],
options={
'ordering': ['-date'],
'get_latest_by': 'date',
"ordering": ["-date"],
"get_latest_by": "date",
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TwitterCache',
name="TwitterCache",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('account', models.CharField(unique=True, max_length=100, db_index=True)),
('tweets', picklefield.fields.PickledObjectField(default=list, editable=False)),
('updated', django_extensions.db.fields.ModificationDateTimeField(default=django.utils.timezone.now, editable=False, blank=True)),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("account", models.CharField(unique=True, max_length=100, db_index=True)),
("tweets", picklefield.fields.PickledObjectField(default=list, editable=False)),
("updated", django_extensions.db.fields.ModificationDateTimeField(default=django.utils.timezone.now, editable=False, blank=True)),
],
options={
},
options={},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='contributoractivity',
unique_together=set([('date', 'source_name', 'team_name')]),
name="contributoractivity",
unique_together=set([("date", "source_name", "team_name")]),
),
]
24 changes: 12 additions & 12 deletions bedrock/mozorg/migrations/0002_blogarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
class Migration(migrations.Migration):

dependencies = [
('mozorg', '0001_initial'),
("mozorg", "0001_initial"),
]

operations = [
migrations.CreateModel(
name='BlogArticle',
name="BlogArticle",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('blog_slug', models.CharField(max_length=30)),
('blog_name', models.CharField(max_length=50)),
('published', models.DateTimeField()),
('updated', models.DateTimeField()),
('title', models.CharField(max_length=255)),
('summary', models.TextField()),
('link', models.URLField()),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("blog_slug", models.CharField(max_length=30)),
("blog_name", models.CharField(max_length=50)),
("published", models.DateTimeField()),
("updated", models.DateTimeField()),
("title", models.CharField(max_length=255)),
("summary", models.TextField()),
("link", models.URLField()),
],
options={
'ordering': ['-published'],
'get_latest_by': 'published',
"ordering": ["-published"],
"get_latest_by": "published",
},
),
]
4 changes: 2 additions & 2 deletions bedrock/mozorg/migrations/0003_delete_blogarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
class Migration(migrations.Migration):

dependencies = [
('mozorg', '0002_blogarticle'),
("mozorg", "0002_blogarticle"),
]

operations = [
migrations.DeleteModel(
name='BlogArticle',
name="BlogArticle",
),
]
6 changes: 3 additions & 3 deletions bedrock/mozorg/migrations/0004_auto_20200122_0957.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
class Migration(migrations.Migration):

dependencies = [
('mozorg', '0003_delete_blogarticle'),
("mozorg", "0003_delete_blogarticle"),
]

operations = [
migrations.DeleteModel(
name='ContributorActivity',
name="ContributorActivity",
),
migrations.DeleteModel(
name='TwitterCache',
name="TwitterCache",
),
]
11 changes: 5 additions & 6 deletions bedrock/newsletter/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Newsletter',
name="Newsletter",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('slug', models.SlugField(help_text=b'The ID for the newsletter that will be used by clients', unique=True)),
('data', django_extensions.db.fields.json.JSONField()),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("slug", models.SlugField(help_text=b"The ID for the newsletter that will be used by clients", unique=True)),
("data", django_extensions.db.fields.json.JSONField()),
],
),
]
8 changes: 4 additions & 4 deletions bedrock/newsletter/migrations/0002_auto_20200122_0957.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
class Migration(migrations.Migration):

dependencies = [
('newsletter', '0001_initial'),
("newsletter", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name='newsletter',
name='slug',
field=models.SlugField(help_text='The ID for the newsletter that will be used by clients', unique=True),
model_name="newsletter",
name="slug",
field=models.SlugField(help_text="The ID for the newsletter that will be used by clients", unique=True),
),
]
Loading