@@ -6,8 +6,6 @@ import 'package:clock/clock.dart';
66import 'package:logging/logging.dart' ;
77import 'package:meta/meta.dart' ;
88import 'package:pub_dev/account/models.dart' ;
9- import 'package:pub_dev/package/api_export/api_exporter.dart' ;
10- import 'package:pub_dev/package/backend.dart' ;
119import 'package:pub_dev/package/models.dart' ;
1210import 'package:pub_dev/publisher/models.dart' ;
1311import 'package:pub_dev/shared/datastore.dart' ;
@@ -28,34 +26,6 @@ Future<void> backfillNewFields() async {
2826@visibleForTesting
2927Future <void > migrateIsBlocked () async {
3028 _logger.info ('Migrating isBlocked...' );
31- final pkgQuery = dbService.query <Package >()..filter ('isBlocked =' , true );
32- await for (final entity in pkgQuery.run ()) {
33- await withRetryTransaction (dbService, (tx) async {
34- final pkg = await tx.lookupValue <Package >(entity.key);
35- // sanity check
36- if (! pkg.isBlocked) {
37- return ;
38- }
39- pkg
40- ..isModerated = true
41- ..moderatedAt = pkg.moderatedAt ?? pkg.blocked ?? clock.now ()
42- ..isBlocked = false
43- ..blocked = null
44- ..blockedReason = null ;
45- tx.insert (pkg);
46- });
47-
48- // sync exported API(s)
49- await apiExporter? .synchronizePackage (entity.name! , forceDelete: true );
50-
51- // retract or re-populate public archive files
52- await packageBackend.tarballStorage.updatePublicArchiveBucket (
53- package: entity.name! ,
54- ageCheckThreshold: Duration .zero,
55- deleteIfOlder: Duration .zero,
56- );
57- }
58-
5929 final publisherQuery = dbService.query <Publisher >()
6030 ..filter ('isBlocked =' , true );
6131 await for (final entity in publisherQuery.run ()) {
@@ -95,12 +65,12 @@ Future<void> migrateIsBlocked() async {
9565Future <void > _removeKnownUnmappedFields () async {
9666 await for (final p in dbService.query <Package >().run ()) {
9767 if (p.additionalProperties.isEmpty) continue ;
98- if (p.additionalProperties.containsKey ('isWithheld ' ) ||
99- p.additionalProperties.containsKey ('withheldReason ' )) {
68+ if (p.additionalProperties.containsKey ('blocked ' ) ||
69+ p.additionalProperties.containsKey ('blockedReason ' )) {
10070 await withRetryTransaction (dbService, (tx) async {
10171 final pkg = await tx.lookupValue <Package >(p.key);
102- pkg.additionalProperties.remove ('isWithheld ' );
103- pkg.additionalProperties.remove ('withheldReason ' );
72+ pkg.additionalProperties.remove ('blocked ' );
73+ pkg.additionalProperties.remove ('blockedReason ' );
10474 tx.insert (pkg);
10575 });
10676 }
0 commit comments