-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
80 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
38 changes: 38 additions & 0 deletions
38
push_notifications/migrations/0006_gcmdevice_device_uuid.py
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,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.6 on 2017-04-08 19:17 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import uuid | ||
|
||
|
||
def migrate_device_id(apps, schema_editor): | ||
GCMDevice = apps.get_model("push_notifications", "GCMDevice") | ||
for device in GCMDevice.objects.all(): | ||
device.device_uuid = uuid.UUID(int=int(device.device_id, 16)) | ||
device.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('push_notifications', '0005_applicationid'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='gcmdevice', | ||
name='device_uuid', | ||
field=models.UUIDField(blank=True, db_index=True, help_text='ANDROID_ID / TelephonyManager.getDeviceId()', null=True, verbose_name='Device ID'), | ||
), | ||
migrations.RunPython(migrate_device_id), | ||
migrations.RemoveField( | ||
model_name='gcmdevice', | ||
name='device_id', | ||
), | ||
migrations.RenameField( | ||
model_name='gcmdevice', | ||
old_name='device_uuid', | ||
new_name='device_id', | ||
), | ||
] |
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