Coverage for distro_tracker/core/migrations/0001_initial_v2.py: 100%

10 statements  

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

1# Generated by Django 3.2.20 on 2023-08-19 16:25 

2 

3import distro_tracker.core.models 

4import distro_tracker.core.utils 

5from django.conf import settings 

6from django.db import migrations, models 

7import django.db.models.deletion 

8 

9 

10class Migration(migrations.Migration): 

11 

12 initial = True 

13 

14 replaces = [ 

15 ('core', '0001_initial'), 

16 ('core', '0004_longer_version'), 

17 ('core', '0005_uri_as_char_field'), 

18 ('core', '0008_drop-release-goals'), 

19 ('core', '0009_unique_constraint_on_subscriptions'), 

20 ('core', '0010_drop_priority_section_on_source_package'), 

21 ('core', '0011_sourcepackagerepositoryentry_component'), 

22 ('core', '0012_rename_packageextractedinfo_packagedata'), 

23 ('core', '0013_packagedata_to_package_related_name'), 

24 ('core', '0014_taskdata'), 

25 ('core', '0015_delete_runningjob'), 

26 ('core', '0017_increase_max_length_on_version'), 

27 ('core', '0018_big_auto_fields'), 

28 ('core', '0019_auto_20230731_2032'), 

29 ] 

30 

31 dependencies = [ 

32 ('django_email_accounts', '0001_initial_v2'), 

33 migrations.swappable_dependency(settings.AUTH_USER_MODEL), 

34 ] 

35 

36 operations = [ 

37 migrations.CreateModel( 

38 name='ActionItemType', 

39 fields=[ 

40 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

41 ('type_name', models.TextField(max_length=100, unique=True)), 

42 ('full_description_template', models.CharField(blank=True, max_length=255, null=True)), 

43 ], 

44 ), 

45 migrations.CreateModel( 

46 name='Architecture', 

47 fields=[ 

48 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

49 ('name', models.CharField(max_length=30, unique=True)), 

50 ], 

51 ), 

52 migrations.CreateModel( 

53 name='ContributorName', 

54 fields=[ 

55 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

56 ('name', models.CharField(blank=True, max_length=60)), 

57 ('contributor_email', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_email_accounts.useremail')), 

58 ], 

59 options={ 

60 'unique_together': {('contributor_email', 'name')}, 

61 }, 

62 ), 

63 migrations.CreateModel( 

64 name='EmailSettings', 

65 fields=[ 

66 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

67 ], 

68 ), 

69 migrations.CreateModel( 

70 name='Keyword', 

71 fields=[ 

72 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

73 ('name', models.CharField(max_length=50, unique=True)), 

74 ('default', models.BooleanField(default=False)), 

75 ('description', models.CharField(blank=True, max_length=256)), 

76 ], 

77 ), 

78 migrations.CreateModel( 

79 name='MailingList', 

80 fields=[ 

81 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

82 ('name', models.CharField(max_length=100)), 

83 ('domain', models.CharField(max_length=255, unique=True)), 

84 ('archive_url_template', models.CharField(max_length=255, validators=[distro_tracker.core.models.validate_archive_url_template])), 

85 ], 

86 ), 

87 migrations.CreateModel( 

88 name='PackageName', 

89 fields=[ 

90 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

91 ('name', models.CharField(max_length=100, unique=True)), 

92 ('source', models.BooleanField(default=False)), 

93 ('binary', models.BooleanField(default=False)), 

94 ('pseudo', models.BooleanField(default=False)), 

95 ], 

96 ), 

97 migrations.CreateModel( 

98 name='Repository', 

99 fields=[ 

100 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

101 ('name', models.CharField(max_length=50, unique=True)), 

102 ('shorthand', models.CharField(max_length=10, unique=True)), 

103 ('uri', models.CharField(max_length=200, verbose_name='URI')), 

104 ('public_uri', models.URLField(blank=True, verbose_name='public URI')), 

105 ('suite', models.CharField(max_length=50)), 

106 ('codename', models.CharField(blank=True, max_length=50)), 

107 ('components', distro_tracker.core.utils.SpaceDelimitedTextField()), 

108 ('default', models.BooleanField(default=False)), 

109 ('optional', models.BooleanField(default=True)), 

110 ('binary', models.BooleanField(default=True)), 

111 ('source', models.BooleanField(default=True)), 

112 ('position', models.IntegerField(default=0)), 

113 ('architectures', models.ManyToManyField(blank=True, to='core.Architecture')), 

114 ], 

115 options={ 

116 'verbose_name_plural': 'repositories', 

117 'ordering': ('position',), 

118 }, 

119 ), 

120 migrations.CreateModel( 

121 name='SourcePackage', 

122 fields=[ 

123 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

124 ('version', models.CharField(max_length=200)), 

125 ('standards_version', models.CharField(blank=True, max_length=550)), 

126 ('dsc_file_name', models.CharField(blank=True, max_length=255)), 

127 ('directory', models.CharField(blank=True, max_length=255)), 

128 ('homepage', models.URLField(blank=True, max_length=255)), 

129 ('vcs', models.JSONField(null=True)), 

130 ('architectures', models.ManyToManyField(blank=True, to='core.Architecture')), 

131 ('maintainer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='source_package', to='core.contributorname')), 

132 ('uploaders', models.ManyToManyField(related_name='source_packages_uploads_set', to='core.ContributorName')), 

133 ], 

134 ), 

135 migrations.CreateModel( 

136 name='TaskData', 

137 fields=[ 

138 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

139 ('task_name', models.CharField(max_length=250, unique=True)), 

140 ('task_is_pending', models.BooleanField(default=False)), 

141 ('run_lock', models.DateTimeField(default=None, null=True)), 

142 ('last_attempted_run', models.DateTimeField(default=None, null=True)), 

143 ('last_completed_run', models.DateTimeField(default=None, null=True)), 

144 ('data', models.JSONField(default=dict)), 

145 ('data_checksum', models.CharField(default=None, max_length=40, null=True)), 

146 ('version', models.IntegerField(default=0)), 

147 ], 

148 ), 

149 migrations.CreateModel( 

150 name='Team', 

151 fields=[ 

152 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

153 ('name', models.CharField(max_length=100, unique=True)), 

154 ('slug', models.SlugField(help_text='Used in the URL (/teams/<em>identifier</em>/) and in the associated email address team+<em>identifier</em>@<em>domain</em>.', unique=True, verbose_name='Identifier')), 

155 ('description', models.TextField(blank=True, null=True)), 

156 ('url', models.URLField(blank=True, max_length=255, null=True)), 

157 ('public', models.BooleanField(default=True)), 

158 ('maintainer_email', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='django_email_accounts.useremail')), 

159 ], 

160 ), 

161 migrations.CreateModel( 

162 name='TeamMembership', 

163 fields=[ 

164 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

165 ('muted', models.BooleanField(default=False)), 

166 ('has_membership_keywords', models.BooleanField(default=False)), 

167 ('default_keywords', models.ManyToManyField(to='core.Keyword')), 

168 ('team', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_membership_set', to='core.team')), 

169 ('user_email', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='membership_set', to='django_email_accounts.useremail')), 

170 ], 

171 options={ 

172 'unique_together': {('user_email', 'team')}, 

173 }, 

174 ), 

175 migrations.AddField( 

176 model_name='team', 

177 name='members', 

178 field=models.ManyToManyField(related_name='teams', through='core.TeamMembership', to='django_email_accounts.UserEmail'), 

179 ), 

180 migrations.AddField( 

181 model_name='team', 

182 name='owner', 

183 field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='owned_teams', to=settings.AUTH_USER_MODEL), 

184 ), 

185 migrations.AddField( 

186 model_name='team', 

187 name='packages', 

188 field=models.ManyToManyField(related_name='teams', to='core.PackageName'), 

189 ), 

190 migrations.CreateModel( 

191 name='Subscription', 

192 fields=[ 

193 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

194 ('active', models.BooleanField(default=True)), 

195 ('_use_user_default_keywords', models.BooleanField(default=True)), 

196 ('_keywords', models.ManyToManyField(to='core.Keyword')), 

197 ('email_settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.emailsettings')), 

198 ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.packagename')), 

199 ], 

200 options={ 

201 'unique_together': {('email_settings', 'package')}, 

202 }, 

203 ), 

204 migrations.CreateModel( 

205 name='SourcePackageRepositoryEntry', 

206 fields=[ 

207 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

208 ('component', models.CharField(blank=True, max_length=50)), 

209 ('repository', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='source_entries', to='core.repository')), 

210 ('source_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='repository_entries', to='core.sourcepackage')), 

211 ], 

212 options={ 

213 'unique_together': {('source_package', 'repository')}, 

214 }, 

215 ), 

216 migrations.AddField( 

217 model_name='repository', 

218 name='source_packages', 

219 field=models.ManyToManyField(through='core.SourcePackageRepositoryEntry', to='core.SourcePackage'), 

220 ), 

221 migrations.AddField( 

222 model_name='packagename', 

223 name='subscriptions', 

224 field=models.ManyToManyField(through='core.Subscription', to='core.EmailSettings'), 

225 ), 

226 migrations.CreateModel( 

227 name='PackageBugStats', 

228 fields=[ 

229 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

230 ('stats', models.JSONField(default=dict)), 

231 ('package', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='bug_stats', to='core.packagename')), 

232 ], 

233 ), 

234 migrations.CreateModel( 

235 name='News', 

236 fields=[ 

237 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

238 ('title', models.CharField(max_length=255)), 

239 ('content_type', models.CharField(default='text/plain', max_length=100)), 

240 ('_db_content', models.TextField(blank=True, null=True)), 

241 ('news_file', models.FileField(blank=True, upload_to=distro_tracker.core.models.news_upload_path)), 

242 ('created_by', models.CharField(blank=True, max_length=100)), 

243 ('datetime_created', models.DateTimeField(auto_now_add=True)), 

244 ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.packagename')), 

245 ('signed_by', models.ManyToManyField(related_name='signed_news_set', to='core.ContributorName')), 

246 ], 

247 ), 

248 migrations.CreateModel( 

249 name='MembershipConfirmation', 

250 fields=[ 

251 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

252 ('confirmation_key', models.CharField(max_length=40, unique=True)), 

253 ('date_created', models.DateTimeField(auto_now_add=True)), 

254 ('membership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.teammembership')), 

255 ], 

256 options={ 

257 'abstract': False, 

258 }, 

259 ), 

260 migrations.AddField( 

261 model_name='emailsettings', 

262 name='default_keywords', 

263 field=models.ManyToManyField(to='core.Keyword'), 

264 ), 

265 migrations.AddField( 

266 model_name='emailsettings', 

267 name='user_email', 

268 field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='django_email_accounts.useremail'), 

269 ), 

270 migrations.CreateModel( 

271 name='BinaryPackage', 

272 fields=[ 

273 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

274 ('version', models.CharField(max_length=200)), 

275 ('short_description', models.CharField(blank=True, max_length=300)), 

276 ('long_description', models.TextField(blank=True)), 

277 ('source_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.sourcepackage')), 

278 ], 

279 ), 

280 migrations.CreateModel( 

281 name='BinaryPackageName', 

282 fields=[ 

283 ], 

284 options={ 

285 'proxy': True, 

286 'indexes': [], 

287 'constraints': [], 

288 }, 

289 bases=('core.packagename',), 

290 ), 

291 migrations.CreateModel( 

292 name='EmailNews', 

293 fields=[ 

294 ], 

295 options={ 

296 'proxy': True, 

297 'indexes': [], 

298 'constraints': [], 

299 }, 

300 bases=('core.news',), 

301 ), 

302 migrations.CreateModel( 

303 name='PseudoPackageName', 

304 fields=[ 

305 ], 

306 options={ 

307 'proxy': True, 

308 'indexes': [], 

309 'constraints': [], 

310 }, 

311 bases=('core.packagename',), 

312 ), 

313 migrations.CreateModel( 

314 name='SourcePackageName', 

315 fields=[ 

316 ], 

317 options={ 

318 'proxy': True, 

319 'indexes': [], 

320 'constraints': [], 

321 }, 

322 bases=('core.packagename',), 

323 ), 

324 migrations.AddField( 

325 model_name='sourcepackage', 

326 name='binary_packages', 

327 field=models.ManyToManyField(blank=True, to='core.BinaryPackageName'), 

328 ), 

329 migrations.AddField( 

330 model_name='sourcepackage', 

331 name='source_package_name', 

332 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='source_package_versions', to='core.sourcepackagename'), 

333 ), 

334 migrations.CreateModel( 

335 name='RepositoryRelation', 

336 fields=[ 

337 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

338 ('name', models.CharField(choices=[('derivative', 'Derivative repository (target=parent)'), ('overlay', 'Overlay of target repository')], max_length=50)), 

339 ('repository', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='relations', to='core.repository')), 

340 ('target_repository', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reverse_relations', to='core.repository')), 

341 ], 

342 options={ 

343 'unique_together': {('repository', 'name')}, 

344 }, 

345 ), 

346 migrations.CreateModel( 

347 name='RepositoryFlag', 

348 fields=[ 

349 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

350 ('name', models.CharField(choices=[('hidden', 'Hidden repository')], max_length=50)), 

351 ('value', models.BooleanField(default=False)), 

352 ('repository', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='flags', to='core.repository')), 

353 ], 

354 options={ 

355 'unique_together': {('repository', 'name')}, 

356 }, 

357 ), 

358 migrations.CreateModel( 

359 name='PackageData', 

360 fields=[ 

361 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

362 ('key', models.CharField(max_length=50)), 

363 ('value', models.JSONField(default=dict)), 

364 ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='data', to='core.packagename')), 

365 ], 

366 options={ 

367 'unique_together': {('key', 'package')}, 

368 }, 

369 ), 

370 migrations.CreateModel( 

371 name='MembershipPackageSpecifics', 

372 fields=[ 

373 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

374 ('_has_keywords', models.BooleanField(default=False)), 

375 ('muted', models.BooleanField(default=False)), 

376 ('keywords', models.ManyToManyField(to='core.Keyword')), 

377 ('membership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='membership_package_specifics', to='core.teammembership')), 

378 ('package_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.packagename')), 

379 ], 

380 options={ 

381 'unique_together': {('membership', 'package_name')}, 

382 }, 

383 ), 

384 migrations.CreateModel( 

385 name='ExtractedSourceFile', 

386 fields=[ 

387 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

388 ('extracted_file', models.FileField(upload_to=distro_tracker.core.models._extracted_source_file_upload_path)), 

389 ('name', models.CharField(max_length=100)), 

390 ('date_extracted', models.DateTimeField(auto_now_add=True)), 

391 ('source_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='extracted_source_files', to='core.sourcepackage')), 

392 ], 

393 options={ 

394 'unique_together': {('source_package', 'name')}, 

395 }, 

396 ), 

397 migrations.CreateModel( 

398 name='BinaryPackageRepositoryEntry', 

399 fields=[ 

400 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

401 ('priority', models.CharField(blank=True, max_length=50)), 

402 ('section', models.CharField(blank=True, max_length=50)), 

403 ('architecture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.architecture')), 

404 ('binary_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='repository_entries', to='core.binarypackage')), 

405 ('repository', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='binary_entries', to='core.repository')), 

406 ], 

407 options={ 

408 'unique_together': {('binary_package', 'repository', 'architecture')}, 

409 }, 

410 ), 

411 migrations.CreateModel( 

412 name='BinaryPackageBugStats', 

413 fields=[ 

414 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

415 ('stats', models.JSONField(default=dict)), 

416 ('package', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='binary_bug_stats', to='core.binarypackagename')), 

417 ], 

418 ), 

419 migrations.AddField( 

420 model_name='binarypackage', 

421 name='binary_package_name', 

422 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='binary_package_versions', to='core.binarypackagename'), 

423 ), 

424 migrations.CreateModel( 

425 name='ActionItem', 

426 fields=[ 

427 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

428 ('short_description', models.TextField()), 

429 ('severity', models.IntegerField(choices=[(0, 'wishlist'), (1, 'low'), (2, 'normal'), (3, 'high'), (4, 'critical')], default=2)), 

430 ('created_timestamp', models.DateTimeField(auto_now_add=True)), 

431 ('last_updated_timestamp', models.DateTimeField(auto_now=True)), 

432 ('extra_data', models.JSONField(default=dict)), 

433 ('item_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_items', to='core.actionitemtype')), 

434 ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_items', to='core.packagename')), 

435 ], 

436 options={ 

437 'unique_together': {('package', 'item_type')}, 

438 }, 

439 ), 

440 migrations.CreateModel( 

441 name='SourcePackageDeps', 

442 fields=[ 

443 ('id', models.BigAutoField(primary_key=True, serialize=False)), 

444 ('build_dep', models.BooleanField(default=False)), 

445 ('binary_dep', models.BooleanField(default=False)), 

446 ('details', models.JSONField(default=dict)), 

447 ('repository', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.repository')), 

448 ('dependency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='source_dependents', to='core.sourcepackagename')), 

449 ('source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='source_dependencies', to='core.sourcepackagename')), 

450 ], 

451 options={ 

452 'unique_together': {('source', 'dependency', 'repository')}, 

453 }, 

454 ), 

455 migrations.AlterUniqueTogether( 

456 name='sourcepackage', 

457 unique_together={('source_package_name', 'version')}, 

458 ), 

459 migrations.AlterUniqueTogether( 

460 name='binarypackage', 

461 unique_together={('binary_package_name', 'version')}, 

462 ), 

463 ]