From 1ebf4403835b2b368fbe2c6807ea79a09cf86090 Mon Sep 17 00:00:00 2001 From: mscherer Date: Wed, 11 Mar 2026 20:40:28 +0100 Subject: [PATCH] Stop using deprecated setOnDelete/setOnUpdate methods Update bake templates and internal code to use the non-deprecated setDelete() and setUpdate() methods instead of the deprecated setOnDelete() and setOnUpdate() methods. Fixes #1045 --- src/Db/Table/ForeignKey.php | 6 +++--- templates/bake/element/add-foreign-keys.twig | 4 ++-- templates/bake/element/change-method-body.twig | 4 ++-- tests/TestCase/Db/Table/TableTest.php | 3 +-- .../Diff/default/the_diff_default_mysql.php | 8 ++++---- .../Diff/default/the_diff_default_pgsql.php | 12 ++++++------ .../Diff/simple/the_diff_simple_mysql.php | 4 ++-- .../pgsql/test_snapshot_auto_id_disabled_pgsql.php | 12 ++++++------ .../pgsql/test_snapshot_not_empty_pgsql.php | 12 ++++++------ .../pgsql/test_snapshot_plugin_blog_pgsql.php | 12 ++++++------ .../pgsql/test_snapshot_with_change_pgsql.php | 12 ++++++------ .../sqlite/test_snapshot_auto_id_disabled_sqlite.php | 12 ++++++------ .../sqlite/test_snapshot_not_empty_sqlite.php | 12 ++++++------ .../sqlite/test_snapshot_plugin_blog_sqlite.php | 12 ++++++------ .../sqlite/test_snapshot_with_change_sqlite.php | 12 ++++++------ .../test_snapshot_auto_id_disabled_sqlserver.php | 12 ++++++------ .../sqlserver/test_snapshot_not_empty_sqlserver.php | 12 ++++++------ .../test_snapshot_plugin_blog_sqlserver.php | 12 ++++++------ .../test_snapshot_with_change_sqlserver.php | 12 ++++++------ .../Migration/testAddFieldWithReference.php | 4 ++-- .../Migration/testCreateWithReferences.php | 4 ++-- .../testCreateWithReferencesCustomTable.php | 4 ++-- .../Migration/test_snapshot_auto_id_disabled.php | 12 ++++++------ .../Migration/test_snapshot_not_empty.php | 12 ++++++------ .../Migration/test_snapshot_plugin_blog.php | 12 ++++++------ .../test_snapshot_postgres_timestamp_tz_pgsql.php | 12 ++++++------ ...t_with_auto_id_compatible_signed_primary_keys.php | 12 ++++++------ ...with_auto_id_incompatible_signed_primary_keys.php | 12 ++++++------ ...th_auto_id_incompatible_unsigned_primary_keys.php | 12 ++++++------ .../Migration/test_snapshot_with_change.php | 12 ++++++------ .../test_snapshot_with_non_default_collation.php | 12 ++++++------ 31 files changed, 152 insertions(+), 153 deletions(-) diff --git a/src/Db/Table/ForeignKey.php b/src/Db/Table/ForeignKey.php index 907e5f375..3e4a4d394 100644 --- a/src/Db/Table/ForeignKey.php +++ b/src/Db/Table/ForeignKey.php @@ -100,11 +100,11 @@ public function setOptions(array $options) throw new RuntimeException(sprintf('"%s" is not a valid foreign key option.', $option)); } - // handle $options['delete'] as $options['update'] + // handle $options['delete'] and $options['update'] if ($option === 'delete') { - $this->setOnDelete($value); + $this->delete = $this->normalizeAction($value); } elseif ($option === 'update') { - $this->setOnUpdate($value); + $this->update = $this->normalizeAction($value); } elseif ($option === 'deferrable') { $this->setDeferrableMode($value); } else { diff --git a/templates/bake/element/add-foreign-keys.twig b/templates/bake/element/add-foreign-keys.twig index 774cf80d8..9f67c0e5c 100644 --- a/templates/bake/element/add-foreign-keys.twig +++ b/templates/bake/element/add-foreign-keys.twig @@ -28,8 +28,8 @@ $this->foreignKey({{ columnsList | raw }}) ->setReferencedTable('{{ constraint['references'][0] }}') ->setReferencedColumns({{ columnsReference | raw }}) - ->setOnDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') - ->setOnUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') + ->setDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') + ->setUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') ->setName('{{ constraintName }}') ) {%~ endif %} diff --git a/templates/bake/element/change-method-body.twig b/templates/bake/element/change-method-body.twig index e1370cd4f..e36e7fb44 100644 --- a/templates/bake/element/change-method-body.twig +++ b/templates/bake/element/change-method-body.twig @@ -59,8 +59,8 @@ $this->foreignKey({{ columnsList | raw }}) ->setReferencedTable('{{ constraint['references'][0] }}') ->setReferencedColumns({{ columnsReference | raw }}) - ->setOnDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') - ->setOnUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') + ->setDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') + ->setUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') ->setName('{{ constraintName }}') ); {%~ endif %} diff --git a/tests/TestCase/Db/Table/TableTest.php b/tests/TestCase/Db/Table/TableTest.php index 21912fd58..463e9aa86 100644 --- a/tests/TestCase/Db/Table/TableTest.php +++ b/tests/TestCase/Db/Table/TableTest.php @@ -144,8 +144,7 @@ public function testAddForeignKeyWithObject(): void $key->setColumns('user_id') ->setReferencedTable('users') ->setReferencedColumns(['id']) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setOptions(['delete' => 'CASCADE', 'update' => 'CASCADE']) ->setName('fk_user_id'), ); diff --git a/tests/comparisons/Diff/default/the_diff_default_mysql.php b/tests/comparisons/Diff/default/the_diff_default_mysql.php index a889d9e7c..4dce76e41 100644 --- a/tests/comparisons/Diff/default/the_diff_default_mysql.php +++ b/tests/comparisons/Diff/default/the_diff_default_mysql.php @@ -99,8 +99,8 @@ public function up(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('RESTRICT') - ->setOnUpdate('RESTRICT') + ->setDelete('RESTRICT') + ->setUpdate('RESTRICT') ->setName('categories_ibfk_1') ) ->update(); @@ -232,8 +232,8 @@ public function down(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('articles_ibfk_1') ) ->update(); diff --git a/tests/comparisons/Diff/default/the_diff_default_pgsql.php b/tests/comparisons/Diff/default/the_diff_default_pgsql.php index 54b61d85f..52e1f0766 100644 --- a/tests/comparisons/Diff/default/the_diff_default_pgsql.php +++ b/tests/comparisons/Diff/default/the_diff_default_pgsql.php @@ -64,8 +64,8 @@ public function up(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('RESTRICT') - ->setOnUpdate('RESTRICT') + ->setDelete('RESTRICT') + ->setUpdate('RESTRICT') ) ->update(); @@ -114,8 +114,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ) ->update(); @@ -207,8 +207,8 @@ public function down(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ) ->update(); diff --git a/tests/comparisons/Diff/simple/the_diff_simple_mysql.php b/tests/comparisons/Diff/simple/the_diff_simple_mysql.php index 93edeb6d8..65565a196 100644 --- a/tests/comparisons/Diff/simple/the_diff_simple_mysql.php +++ b/tests/comparisons/Diff/simple/the_diff_simple_mysql.php @@ -70,8 +70,8 @@ public function up(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('RESTRICT') - ->setOnUpdate('RESTRICT') + ->setDelete('RESTRICT') + ->setUpdate('RESTRICT') ->setName('articles_ibfk_1') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php index eca100cc3..bbe494204 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php @@ -370,8 +370,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -387,8 +387,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -398,8 +398,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php index e297c18ce..8ff44ed60 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php @@ -310,8 +310,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -327,8 +327,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -338,8 +338,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php index 2541ce034..25f27019b 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php @@ -310,8 +310,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -327,8 +327,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -338,8 +338,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php index 1191bd8c9..2c3cb4f59 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php @@ -310,8 +310,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -327,8 +327,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -338,8 +338,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php index 24da5e35f..12261cdd3 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php @@ -351,8 +351,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -368,8 +368,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -379,8 +379,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php index e292c18e3..bef6d8cea 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php @@ -291,8 +291,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -308,8 +308,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -319,8 +319,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php index 78ae984e4..f9f840281 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php @@ -291,8 +291,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -308,8 +308,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -319,8 +319,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php index f1fbd6eec..857bbde1d 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php @@ -291,8 +291,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -308,8 +308,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -319,8 +319,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php index 347b5cdd5..47b630bfd 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php @@ -386,8 +386,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -403,8 +403,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -414,8 +414,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php index e0aad74e8..aa2bc9a34 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php @@ -326,8 +326,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -343,8 +343,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -354,8 +354,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php index c8d0e8dbf..8e49310d4 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php @@ -326,8 +326,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -343,8 +343,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -354,8 +354,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php index 36ef3a9b1..f1282faf4 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php @@ -326,8 +326,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -343,8 +343,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -354,8 +354,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/testAddFieldWithReference.php b/tests/comparisons/Migration/testAddFieldWithReference.php index b50ad2f92..b6c5ccfb2 100644 --- a/tests/comparisons/Migration/testAddFieldWithReference.php +++ b/tests/comparisons/Migration/testAddFieldWithReference.php @@ -25,8 +25,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('fk_category_id') ); $table->update(); diff --git a/tests/comparisons/Migration/testCreateWithReferences.php b/tests/comparisons/Migration/testCreateWithReferences.php index 11c01ca2b..5537e448e 100644 --- a/tests/comparisons/Migration/testCreateWithReferences.php +++ b/tests/comparisons/Migration/testCreateWithReferences.php @@ -30,8 +30,8 @@ public function change(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('fk_user_id') ); $table->create(); diff --git a/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php b/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php index a4829f3c2..6897dd2aa 100644 --- a/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php +++ b/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php @@ -30,8 +30,8 @@ public function change(): void $this->foreignKey('author_id') ->setReferencedTable('authors') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('fk_author_id') ); $table->create(); diff --git a/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php b/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php index 9024c29ad..c8d07b215 100644 --- a/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php +++ b/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php @@ -376,8 +376,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -393,8 +393,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -404,8 +404,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_not_empty.php b/tests/comparisons/Migration/test_snapshot_not_empty.php index 1a277d711..4bde415d7 100644 --- a/tests/comparisons/Migration/test_snapshot_not_empty.php +++ b/tests/comparisons/Migration/test_snapshot_not_empty.php @@ -308,8 +308,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -325,8 +325,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -336,8 +336,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_plugin_blog.php b/tests/comparisons/Migration/test_snapshot_plugin_blog.php index 20dd3fba9..d33673594 100644 --- a/tests/comparisons/Migration/test_snapshot_plugin_blog.php +++ b/tests/comparisons/Migration/test_snapshot_plugin_blog.php @@ -308,8 +308,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -325,8 +325,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -336,8 +336,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php b/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php index 51b0002a4..e4f7da4f7 100644 --- a/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php +++ b/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php @@ -320,8 +320,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -337,8 +337,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -348,8 +348,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php b/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php index df2ea8ba0..3da752b24 100644 --- a/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php +++ b/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php @@ -375,8 +375,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -392,8 +392,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -403,8 +403,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php index 11fadb44f..13f8327da 100644 --- a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php +++ b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php @@ -375,8 +375,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -392,8 +392,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -403,8 +403,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php index 93570e1ec..bdf099943 100644 --- a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php +++ b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php @@ -376,8 +376,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -393,8 +393,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -404,8 +404,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_change.php b/tests/comparisons/Migration/test_snapshot_with_change.php index ec5f12a64..d4a432337 100644 --- a/tests/comparisons/Migration/test_snapshot_with_change.php +++ b/tests/comparisons/Migration/test_snapshot_with_change.php @@ -308,8 +308,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -325,8 +325,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -336,8 +336,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php b/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php index 45cad82a0..c48d00a4e 100644 --- a/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php +++ b/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php @@ -309,8 +309,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -326,8 +326,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -337,8 +337,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update();