Skip to content

Commit 704a89f

Browse files
use chunkById to prevent unexpected database behaviour (#232)
1 parent 8a2fa7f commit 704a89f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

database/migrations/updates/add_id_to_attributes_in_revisions_table.php.stub

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ return new class extends Migration {
99
// Extract the id from the key and add it to the attributes of the revision
1010
RevisionModel::query()
1111
->whereJsonDoesntContainKey('attributes->id')
12-
->chunk(200, function ($revisions) {
12+
->chunkById(200, function ($revisions) {
1313
foreach ($revisions as $revision) {
1414
$id = str($revision->key)
1515
->afterLast('/')
@@ -29,7 +29,7 @@ return new class extends Migration {
2929
// Reverse the above
3030
RevisionModel::query()
3131
->whereJsonContainsKey('attributes->id')
32-
->chunk(200, function ($revisions) {
32+
->chunkById(200, function ($revisions) {
3333
foreach ($revisions as $revision) {
3434
$attributes = $revision->attributes;
3535
unset($attributes['id']);

0 commit comments

Comments
 (0)