Skip to content

Commit

Permalink
Data migration to update ingestor api url
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmwangemi committed Nov 2, 2023
1 parent 52590a1 commit fb29f03
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions peachjam/migrations/0108_update_ingestor_api_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.2.19 on 2023-11-02 13:24
from django.db import migrations


def update_ingestor_api_url(apps, schema_editor):
"""Update the ingestor API URL to use the new API indigo v3."""
Ingestor = apps.get_model("peachjam", "Ingestor")
IngestorSetting = apps.get_model("peachjam", "IngestorSetting")

for ingestor in Ingestor.objects.all():
setting = IngestorSetting.objects.filter(
ingestor=ingestor, name="api_url"
).first()
if setting:
setting.value = "https://api.laws.africa/v3"
setting.save()


class Migration(migrations.Migration):
dependencies = [
("peachjam", "0107_delete_stubs_without_publication_documents"),
]

operations = [
migrations.RunPython(update_ingestor_api_url, migrations.RunPython.noop)
]

0 comments on commit fb29f03

Please sign in to comment.