Coverage for distro_tracker/core/migrations/0002_initial_data_v2.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2025-01-12 09:15 +0000

1# -*- coding: utf-8 -*- 

2 

3from django.db import models, migrations 

4 

5 

6def forwards_func(apps, schema_editor): 

7 # We get the model from the versioned app registry; 

8 # if we directly import it, it'll be the wrong version 

9 Keyword = apps.get_model('core', 'Keyword') 

10 Architecture = apps.get_model('core', 'Architecture') 

11 MailingList = apps.get_model('core', 'MailingList') 

12 db_alias = schema_editor.connection.alias 

13 Keyword.objects.using(db_alias).bulk_create([ 

14 Keyword(name='default', default=True, 

15 description='Anything else that cannot be better classified'), 

16 Keyword(name='bts', default=True, 

17 description='All bug reports and associated discussions'), 

18 Keyword(name='bts-control', default=True, 

19 description='Status changes of bug reports'), 

20 Keyword(name='summary', default=True, 

21 description='News about the status of the package'), 

22 Keyword(name='upload-source', default=True, 

23 description='Notifications of sourceful uploads'), 

24 Keyword(name='archive', default=True, 

25 description='Other notifications sent by the archive management tool'), 

26 Keyword(name='contact', default=True, 

27 description='Mails from people contacting the maintainer(s)'), 

28 Keyword(name='build', default=True, 

29 description='Notifications of build failures from build daemons'), 

30 Keyword(name='vcs', default=False, 

31 description='Commit notices of the VCS repository associated to the package'), 

32 Keyword(name='translation', default=False, 

33 description='Notifications about translations related to the package'), 

34 Keyword(name='upload-binary', default=False, 

35 description='Notifications of binary-only uploads (made by build daemons)'), 

36 Keyword(name='derivatives', default=False, 

37 description='Changes made to this package by derivatives'), 

38 Keyword(name='derivatives-bugs', default=False, 

39 description='Bug traffic about this package in derivative distributions'), 

40 ]) 

41 Architecture.objects.using(db_alias).bulk_create([ 

42 Architecture(name='all'), 

43 Architecture(name='alpha'), 

44 Architecture(name='amd64'), 

45 Architecture(name='any'), 

46 Architecture(name='arm'), 

47 Architecture(name='arm64'), 

48 Architecture(name='armeb'), 

49 Architecture(name='armel'), 

50 Architecture(name='armhf'), 

51 Architecture(name='avr32'), 

52 Architecture(name='hppa'), 

53 Architecture(name='hurd-i386'), 

54 Architecture(name='i386'), 

55 Architecture(name='ia64'), 

56 Architecture(name='kfreebsd-amd64'), 

57 Architecture(name='kfreebsd-i386'), 

58 Architecture(name='m32r'), 

59 Architecture(name='m68k'), 

60 Architecture(name='mips'), 

61 Architecture(name='mips64'), 

62 Architecture(name='mips64el'), 

63 Architecture(name='mipsel'), 

64 Architecture(name='mipsn32'), 

65 Architecture(name='mipsn32el'), 

66 Architecture(name='or1k'), 

67 Architecture(name='powerpc'), 

68 Architecture(name='powerpcel'), 

69 Architecture(name='powerpcspe'), 

70 Architecture(name='ppc64'), 

71 Architecture(name='ppc64el'), 

72 Architecture(name='s390'), 

73 Architecture(name='s390x'), 

74 Architecture(name='sh3'), 

75 Architecture(name='sh3eb'), 

76 Architecture(name='sh4'), 

77 Architecture(name='sh4eb'), 

78 Architecture(name='sparc'), 

79 Architecture(name='sparc64'), 

80 Architecture(name='x32'), 

81 ]) 

82 MailingList.objects.using(db_alias).bulk_create([ 

83 MailingList(name='debian', domain='lists.debian.org', 

84 archive_url_template='https://lists.debian.org/{user}/'), 

85 MailingList(name='ubuntu', domain='lists.ubuntu.com', 

86 archive_url_template='https://lists.ubuntu.com/archives/{user}/'), 

87 MailingList(name='riseup', domain='lists.riseup.net', 

88 archive_url_template='https://lists.riseup.net/www/arc/{user}'), 

89 MailingList(name='launchpad', domain='lists.launchpad.net', 

90 archive_url_template='https://lists.launchpad.net/{user}/'), 

91 MailingList(name='freedesktop', domain='lists.freedesktop.org', 

92 archive_url_template='https://lists.freedesktop.org/archives/{user}/'), 

93 MailingList(name='lxde', domain='lists.lxde.org', 

94 archive_url_template='http://lists.lxde.org/pipermail/{user}/'), 

95 MailingList(name='alioth-debian-net', domain='alioth-lists.debian.net', 

96 archive_url_template='https://alioth-lists.debian.net/pipermail/{user}/'), 

97 ]) 

98 

99 

100class Migration(migrations.Migration): 

101 

102 initial = True 

103 

104 replaces = [ 

105 ('core', '0002_initial_data'), 

106 ('core', '0003_lxde_list_archives'), 

107 ('core', '0006_more_architectures'), 

108 ('core', '0007_keywords_descriptions'), 

109 ('core', '0016_aliothdebiannet_list_archives'), 

110 ] 

111 

112 dependencies = [ 

113 ('core', '0001_initial_v2'), 

114 ] 

115 

116 operations = [ 

117 migrations.RunPython( 

118 forwards_func, 

119 ), 

120 ]