Skip to content

Commit

Permalink
Fixes #18438: Specify batch_size for migrations which run bulk_update()
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Jan 21, 2025
1 parent d11deb6 commit b913661
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Generated by Django 5.0.9 on 2024-10-21 17:34
import django.db.models.deletion
from django.db import migrations, models

Expand All @@ -16,7 +15,7 @@ def populate_denormalized_fields(apps, schema_editor):
termination._site_id = termination.site_id
# Note: Location cannot be set prior to migration

CircuitTermination.objects.bulk_update(terminations, ['_region', '_site_group', '_site'])
CircuitTermination.objects.bulk_update(terminations, ['_region', '_site_group', '_site'], batch_size=100)


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion netbox/ipam/migrations/0072_prefix_cached_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def populate_denormalized_fields(apps, schema_editor):
prefix._site_id = prefix.site_id
# Note: Location cannot be set prior to migration

Prefix.objects.bulk_update(prefixes, ['_region', '_site_group', '_site'])
Prefix.objects.bulk_update(prefixes, ['_region', '_site_group', '_site'], batch_size=100)


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def populate_denormalized_fields(apps, schema_editor):
cluster._site_id = cluster.site_id
# Note: Location cannot be set prior to migration

Cluster.objects.bulk_update(clusters, ['_region', '_site_group', '_site'])
Cluster.objects.bulk_update(clusters, ['_region', '_site_group', '_site'], batch_size=100)


class Migration(migrations.Migration):
Expand Down

0 comments on commit b913661

Please sign in to comment.