-
-
Notifications
You must be signed in to change notification settings - Fork 621
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
7 changed files
with
89 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
19 changes: 19 additions & 0 deletions
19
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,19 @@ | ||
# -*- 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 | ||
|
||
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'), | ||
) | ||
] |
25 changes: 25 additions & 0 deletions
25
push_notifications/migrations/0007_gcmdevice_migrate_data.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,25 @@ | ||
# -*- 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.filter(device_id__isnull=False): | ||
# previously stored as an unsigned integer | ||
device.device_uuid = uuid.UUID(int=device.device_id) | ||
device.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('push_notifications', '0006_gcmdevice_device_uuid'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(migrate_device_id), | ||
] |
24 changes: 24 additions & 0 deletions
24
push_notifications/migrations/0008_gcmdevice_rename_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,24 @@ | ||
# -*- 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 | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('push_notifications', '0007_gcmdevice_migrate_data'), | ||
] | ||
|
||
operations = [ | ||
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