Skip to content

Commit

Permalink
Merge pull request #6675 from stsewd/migrate-old-integrations
Browse files Browse the repository at this point in the history
Data migration for old integration models
  • Loading branch information
ericholscher authored Feb 18, 2020
2 parents 3f6abb5 + cc267db commit 60fb1a3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions readthedocs/integrations/migrations/0007_update-provider-data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-02-18 19:00
from __future__ import unicode_literals

from django.db import migrations


def forwards_func(apps, schema_editor):
"""Old models with provider_data='' are being fetched as str instead of json."""
Integration = apps.get_model('integrations', 'Integration')

Integration.objects.filter(
provider_data='',
).update(
provider_data={},
)


class Migration(migrations.Migration):

dependencies = [
('integrations', '0006_set-default-value-provider-data'),
]

operations = [
migrations.RunPython(forwards_func),
]

0 comments on commit 60fb1a3

Please sign in to comment.