File tree 1 file changed +15
-10
lines changed
1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ final class Version20210610131957 extends AbstractMigration
25
25
26
26
private static $ update = <<<SQL
27
27
UPDATE event_stream
28
- SET payload = '%s'
29
- WHERE uuid = '%s'
30
- AND playhead = %s ;
28
+ SET payload = :payload
29
+ WHERE uuid = :uuid
30
+ AND playhead = :playhead ;
31
31
SQL ;
32
32
33
33
public function up (Schema $ schema ) : void
@@ -36,23 +36,28 @@ public function up(Schema $schema) : void
36
36
$ this ->addSql ('# Updating entities. ' );
37
37
38
38
$ affectedEventStreamRows = $ this ->connection ->executeQuery (self ::$ select );
39
+
40
+ $ this ->write ("<info>Affected records: {$ affectedEventStreamRows ->rowCount ()}</info> " );
41
+
39
42
if ($ affectedEventStreamRows ->rowCount () === 0 ) {
40
43
return ;
41
44
}
45
+
42
46
foreach ($ affectedEventStreamRows as $ eventStream ) {
43
47
$ rawPayload = $ eventStream ['payload ' ];
44
48
$ uuid = $ eventStream ['uuid ' ];
45
49
$ playhead = $ eventStream ['playhead ' ];
46
50
47
- $ payload = $ this ->stripSensitiveData ( $ rawPayload );
51
+ $ this ->write ( " <info>Migating: { $ uuid } # { $ playhead } </info> " );
48
52
53
+ $ payload = $ this ->stripSensitiveData ($ rawPayload );
49
54
$ this ->connection ->executeUpdate (
50
- sprintf (
51
- self :: $ update ,
52
- $ payload ,
53
- $ uuid ,
54
- $ playhead
55
- )
55
+ self :: $ update ,
56
+ [
57
+ ' payload ' => $ payload ,
58
+ ' uuid ' => $ uuid ,
59
+ ' playhead ' => $ playhead,
60
+ ]
56
61
);
57
62
}
58
63
}
You can’t perform that action at this time.
0 commit comments