mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
34 lines
944 B
Python
34 lines
944 B
Python
# Generated by Django 3.0.7 on 2020-11-13 17:27
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def set_origin_id(app_registry, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
books = app_registry.get_model("bookwyrm", "Book").objects.using(db_alias)
|
|
for book in books:
|
|
book.origin_id = book.remote_id
|
|
# the remote_id will be set automatically
|
|
book.remote_id = None
|
|
book.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("bookwyrm", "0010_importjob_retry"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="author",
|
|
name="origin_id",
|
|
field=models.CharField(max_length=255, null=True),
|
|
),
|
|
migrations.AddField(
|
|
model_name="book",
|
|
name="origin_id",
|
|
field=models.CharField(max_length=255, null=True),
|
|
),
|
|
migrations.RunPython(set_origin_id),
|
|
]
|