Coverage for ivatar/ivataraccount/migrations/0007_auto_20180627_0624.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2024-12-26 00:11 +0000

1# Generated by Django 2.0.6 on 2018-06-27 06:24 

2 

3from django.db import migrations, models 

4import django.db.models.deletion 

5 

6def add_sha256(apps, schema_editor): 

7 ''' 

8 Make sure all ConfirmedEmail have digest_sha256 set 

9 in order to alter the model so sha256 may not be NULL 

10 ''' 

11 ConfirmedEmail = apps.get_model('ivataraccount', 'ConfirmedEmail') 

12 for mail in ConfirmedEmail.objects.filter(digest_sha256=None): 

13 mail.save() # pragma: no cover 

14 

15 

16class Migration(migrations.Migration): 

17 

18 dependencies = [ 

19 ('ivataraccount', '0006_auto_20180626_1445'), 

20 ] 

21 

22 operations = [ 

23 migrations.RunPython(add_sha256), 

24 migrations.AlterField( 

25 model_name='confirmedemail', 

26 name='digest_sha256', 

27 field=models.CharField(max_length=64), 

28 ), 

29 migrations.AlterField( 

30 model_name='confirmedemail', 

31 name='photo', 

32 field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='emails', to='ivataraccount.Photo'), 

33 ), 

34 migrations.AlterField( 

35 model_name='confirmedopenid', 

36 name='photo', 

37 field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='openids', to='ivataraccount.Photo'), 

38 ), 

39 ]