-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate UUIDField token_uuid in Invitation model (#3421)
* Migrate token_uuid field in Invitation model to Django UUIDField * Update serializer tests in core Django app * Update view tests in core Django app * Add conversion of UUIDField to string
- Loading branch information
Showing
5 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0033_userprofile_uuid'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='invitation', | ||
name='temp_uuid', | ||
field=models.UUIDField(null=True), | ||
), | ||
# allow backward migrations and remove dependency on django_extensions | ||
migrations.AlterField( | ||
model_name='invitation', | ||
name='token_uuid', | ||
field=models.CharField(max_length=36, null=True), | ||
), | ||
# copy data to the new field | ||
migrations.RunSQL( | ||
"UPDATE core_invitation SET temp_uuid = CAST (token_uuid AS uuid)", | ||
"UPDATE core_invitation SET token_uuid = temp_uuid" | ||
), | ||
migrations.RemoveField( | ||
model_name='invitation', | ||
name='token_uuid', | ||
), | ||
migrations.RenameField( | ||
model_name='invitation', | ||
old_name='temp_uuid', | ||
new_name='token_uuid', | ||
), | ||
migrations.AlterField( | ||
model_name='invitation', | ||
name='token_uuid', | ||
field=models.UUIDField(default=uuid.uuid4, unique=True, editable=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters