From bbadaf53dde049cf463ccb9013e55cf862922498 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 05:40:31 +0000 Subject: [PATCH 1/5] Initial plan From 0efdf800f7723b8c5f36df42eda94b75dadc6fbf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 05:52:14 +0000 Subject: [PATCH 2/5] refactor: remove deprecated MigrationBuilder batchInsert API Agent-Logs-Url: https://github.com/yiisoft/db-migration/sessions/87901949-ba4f-4cc1-8d93-0b49b79574fd Co-authored-by: samdark <47294+samdark@users.noreply.github.com> --- CHANGELOG.md | 2 +- src/MigrationBuilder.php | 24 ------------------- tests/Common/AbstractMigrationBuilderTest.php | 14 ----------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4939d98a..b7e7bd19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.0.2 under development -- New #332: Add `MigrationBuilder::insertBatch()` method, deprecate `batchInsert()` (@vjik) +- New #332: Add `MigrationBuilder::insertBatch()` method, remove deprecated `batchInsert()` (@vjik) - Enh #317: Explicitly import classes, functions, and constants in "use" section (@mspirkov) - Enh #318: Remove unnecessary files from Composer package (@mspirkov) - Enh #319: Remove confirmation prompt from `migrate:create` command as creating a migration is non-destructive (@samdark) diff --git a/src/MigrationBuilder.php b/src/MigrationBuilder.php index a1764b89..b88660a9 100644 --- a/src/MigrationBuilder.php +++ b/src/MigrationBuilder.php @@ -123,30 +123,6 @@ public function insertBatch(string $table, iterable $rows, array $columns = []): $this->endCommand($time); } - /** - * Creates and executes a batch INSERT SQL statement. - * - * The method will properly escape the column names and bind the values to be inserted. - * - * @param string $table The table that new rows will be inserted into. - * @param string[] $columns The column names. - * @param iterable $rows The rows to be batch inserted into the table. - * - * @psalm-param iterable> $rows - * - * @throws Exception - * @throws InvalidConfigException - * @throws NotSupportedException - * - * @deprecated Use {@see insertBatch()} instead. - */ - public function batchInsert(string $table, array $columns, iterable $rows): void - { - $time = $this->beginCommand("Insert into $table"); - $this->db->createCommand()->insertBatch($table, $rows, $columns)->execute(); - $this->endCommand($time); - } - /** * Creates and executes a command to insert rows into a database table if they do not already exist (matching unique * constraints), or update them if they do. diff --git a/tests/Common/AbstractMigrationBuilderTest.php b/tests/Common/AbstractMigrationBuilderTest.php index 214cc892..565f6450 100644 --- a/tests/Common/AbstractMigrationBuilderTest.php +++ b/tests/Common/AbstractMigrationBuilderTest.php @@ -87,20 +87,6 @@ public function testInsertBatchWithColumns(): void $this->builder->dropTable('test'); } - public function testBatchInsert(): void - { - $this->builder->createTable('test', ['id' => ColumnBuilder::integer()]); - $this->builder->batchInsert('test', ['id'], [['id' => 1], ['id' => 2]]); - - $this->assertEquals( - '2', - $this->db->createCommand('SELECT count(*) FROM {{test}} WHERE [[id]] IN (1, 2)')->queryScalar(), - ); - $this->assertInformerOutputContains(' > Insert into test ... Done in '); - - $this->builder->dropTable('test'); - } - public function testUpsertWithoutRow(): void { $this->builder->createTable('test', ['id' => ColumnBuilder::primaryKey(), 'name' => ColumnBuilder::string()]); From 4c9e2487a897b7e19c3c52f2ecb0e1bfcfe38c6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 06:06:03 +0000 Subject: [PATCH 3/5] docs: add changelog entry for batchInsert removal Agent-Logs-Url: https://github.com/yiisoft/db-migration/sessions/4c554b87-64fa-4e15-9a09-26501f813b5f Co-authored-by: samdark <47294+samdark@users.noreply.github.com> --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e7bd19..2d11ef89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## 2.0.2 under development -- New #332: Add `MigrationBuilder::insertBatch()` method, remove deprecated `batchInsert()` (@vjik) +- New #332: Add `MigrationBuilder::insertBatch()` method, deprecate `batchInsert()` (@vjik) +- Chg #335: Remove deprecated `MigrationBuilder::batchInsert()` method (@copilot) - Enh #317: Explicitly import classes, functions, and constants in "use" section (@mspirkov) - Enh #318: Remove unnecessary files from Composer package (@mspirkov) - Enh #319: Remove confirmation prompt from `migrate:create` command as creating a migration is non-destructive (@samdark) From 7ecf2f1d4beaba9ac02d4bf3805acad027cf30bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 06:06:33 +0000 Subject: [PATCH 4/5] docs: normalize changelog author attribution Agent-Logs-Url: https://github.com/yiisoft/db-migration/sessions/4c554b87-64fa-4e15-9a09-26501f813b5f Co-authored-by: samdark <47294+samdark@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d11ef89..f271bb60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 2.0.2 under development - New #332: Add `MigrationBuilder::insertBatch()` method, deprecate `batchInsert()` (@vjik) -- Chg #335: Remove deprecated `MigrationBuilder::batchInsert()` method (@copilot) +- Chg #335: Remove deprecated `MigrationBuilder::batchInsert()` method (@Copilot) - Enh #317: Explicitly import classes, functions, and constants in "use" section (@mspirkov) - Enh #318: Remove unnecessary files from Composer package (@mspirkov) - Enh #319: Remove confirmation prompt from `migrate:create` command as creating a migration is non-destructive (@samdark) From ec7137198e01d81f2833bbfa2c6ca554d41fb16f Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 14 May 2026 09:23:50 +0300 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Alexander Makarov --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f271bb60..7561af3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 2.0.2 under development - New #332: Add `MigrationBuilder::insertBatch()` method, deprecate `batchInsert()` (@vjik) -- Chg #335: Remove deprecated `MigrationBuilder::batchInsert()` method (@Copilot) +- Chg #335: Remove deprecated `MigrationBuilder::batchInsert()` method (@samdark) - Enh #317: Explicitly import classes, functions, and constants in "use" section (@mspirkov) - Enh #318: Remove unnecessary files from Composer package (@mspirkov) - Enh #319: Remove confirmation prompt from `migrate:create` command as creating a migration is non-destructive (@samdark)