Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add summary for data migration
Browse files Browse the repository at this point in the history
jcbalmeida committed Nov 23, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f73c2d5 commit ff889a1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion temba/channels/migrations/0136_external_headers.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

def foward(apps, schema_editor): # pragma: no cover
Channel = apps.get_model("channels", "Channel")

updated, ignored = 0, 0
for channel in Channel.objects.filter(is_active=True, channel_type="EX"):
if "send_authorization" in channel.config:
send_authorization = channel.config.pop("send_authorization")
@@ -16,6 +16,14 @@ def foward(apps, schema_editor): # pragma: no cover
else:
channel.config["headers"]["Authorization"] = send_authorization
channel.save()
updated += 1
else:
ignored += 1

if updated:
print(
f"Headers updated for {updated} External API channels, {ignored} don't have authorization headers and were skipped."
)


def reverse(apps, schema_editor): # pragma: no cover

0 comments on commit ff889a1

Please sign in to comment.