12345678910111213141516171819202122232425262728293031323334353637383940 |
- # Generated by Django 4.0.4 on 2022-04-15 14:38
- from django.db import migrations, models
- import django.db.models.deletion
- def forwards_func(apps, schema_editor):
- File = apps.get_model("files", "File")
- for file in File.objects.all():
- file_blob = file.blobs.first()
- if file_blob:
- file.blob = file_blob
- file.save()
- def reverse_func(apps, schema_editor):
- pass
- class Migration(migrations.Migration):
- dependencies = [
- ("files", "0006_alter_file_headers"),
- ]
- operations = [
- migrations.AddField(
- model_name="file",
- name="blob",
- field=models.ForeignKey(
- null=True,
- on_delete=django.db.models.deletion.CASCADE,
- to="files.fileblob",
- ),
- ),
- migrations.RunPython(forwards_func, reverse_func),
- migrations.RemoveField(
- model_name="file",
- name="blobs",
- ),
- ]
|