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 authored and bctiemann committed Jan 29, 2025
1 parent 61c7702 commit b25ffc3
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

@@ -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):
2 changes: 1 addition & 1 deletion netbox/ipam/migrations/0072_prefix_cached_relations.py
Original file line number Diff line number Diff line change
@@ -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):
Original file line number Diff line number Diff line change
@@ -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):

0 comments on commit b25ffc3

Please sign in to comment.