moviewyrm/bookwyrm/migrations/0035_edition_edition_rank.py

28 lines
685 B
Python
Raw Normal View History

2021-01-11 17:18:40 +00:00
# Generated by Django 3.0.7 on 2021-01-11 17:18
import bookwyrm.models.fields
from django.db import migrations
2021-01-11 17:29:23 +00:00
def set_rank(app_registry, schema_editor):
db_alias = schema_editor.connection.alias
2021-03-08 16:49:10 +00:00
books = app_registry.get_model("bookwyrm", "Edition")
2021-01-11 17:29:23 +00:00
for book in books.objects.using(db_alias):
book.save()
2021-03-08 16:49:10 +00:00
2021-01-11 17:18:40 +00:00
class Migration(migrations.Migration):
dependencies = [
2021-03-08 16:49:10 +00:00
("bookwyrm", "0034_importjob_complete"),
2021-01-11 17:18:40 +00:00
]
operations = [
migrations.AddField(
2021-03-08 16:49:10 +00:00
model_name="edition",
name="edition_rank",
2021-01-11 17:18:40 +00:00
field=bookwyrm.models.fields.IntegerField(default=0),
),
2021-01-11 17:29:23 +00:00
migrations.RunPython(set_rank),
2021-01-11 17:18:40 +00:00
]