Skip to content

Commit

Permalink
refs #528. Fixes migrations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Littman committed Nov 14, 2016
1 parent 3c870ee commit 5066963
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@
from django.db import migrations, models
import datetime
from django.utils.timezone import utc
import ui.models


class Migration(migrations.Migration):

dependencies = [
('ui', '0006_auto_20161101_1121'),
('ui', '0005_user_harvest_notifications'),
]

operations = [
migrations.AddField(
model_name='credential',
name='credential_id',
field=models.CharField(default=ui.models.default_uuid, null=True, max_length=32),
),
migrations.AddField(
model_name='export',
name='date_updated',
field=models.DateTimeField(default=datetime.datetime(2016, 11, 4, 18, 54, 9, 637584, tzinfo=utc), auto_now=True),
field=models.DateTimeField(default=datetime.datetime(2016, 11, 14, 21, 37, 16, 973833, tzinfo=utc), auto_now=True),
preserve_default=False,
),
migrations.AddField(
Expand Down Expand Up @@ -49,6 +55,11 @@ class Migration(migrations.Migration):
name='service',
field=models.CharField(max_length=255, null=True),
),
migrations.AddField(
model_name='historicalcredential',
name='credential_id',
field=models.CharField(default=ui.models.default_uuid, max_length=32, db_index=True),
),
migrations.AlterField(
model_name='export',
name='status',
Expand Down
25 changes: 25 additions & 0 deletions sfm/ui/migrations/0007_auto_20161114_1637.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models

import uuid


def gen_uuid(apps, schema_editor):
MyModel = apps.get_model('ui', 'Credential')
for row in MyModel.objects.all():
row.credential_id = uuid.uuid4()
row.save()


class Migration(migrations.Migration):

dependencies = [
('ui', '0006_auto_20161114_1637'),
]

operations = [
# omit reverse_code=... if you don't want the migration to be reversible.
migrations.RunPython(gen_uuid, reverse_code=migrations.RunPython.noop),
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@
from django.db import migrations, models
import ui.models


class Migration(migrations.Migration):

dependencies = [
('ui', '0005_user_harvest_notifications'),
('ui', '0007_auto_20161114_1637'),
]

operations = [
migrations.AddField(
migrations.AlterField(
model_name='credential',
name='credential_id',
field=models.CharField(default=ui.models.default_uuid, unique=True, max_length=32),
),
migrations.AddField(
model_name='historicalcredential',
name='credential_id',
field=models.CharField(default=ui.models.default_uuid, max_length=32, db_index=True),
),
]

0 comments on commit 5066963

Please sign in to comment.