# Generated by Django 4.2.22 on 2025-08-31 09:11 from django.db import migrations from django_scopes import scopes_disabled def migrate_comments(apps, schema_editor): with scopes_disabled(): Comment = apps.get_model('cookbook', 'Comment') CookLog = apps.get_model('cookbook', 'CookLog') cook_logs = [] for c in Comment.objects.all(): cook_logs.append(CookLog( recipe=c.recipe, created_by=c.created_by, created_at=c.created_at, comment=c.text, space=c.recipe.space, )) CookLog.objects.bulk_create(cook_logs, unique_fields=('recipe', 'comment', 'created_at', 'created_by')) class Migration(migrations.Migration): dependencies = [ ('cookbook', '0222_alter_shoppinglistrecipe_created_by_and_more'), ] operations = [ migrations.RunPython(migrate_comments), ]