@@ -475,14 +475,38 @@ public function testRawSqlConstraint()
475
475
476
476
$ builder = $ this ->db ->table ('user ' );
477
477
478
- $ builder ->setData ($ data , true , 'db_myalias ' )
478
+ $ builder ->setData ($ data , true , 'myalias ' )
479
479
->updateFields ('name, country ' )
480
480
->onConstraint (new RawSql ($ this ->db ->protectIdentifiers ('user.email ' ) . ' = ' . $ this ->db ->protectIdentifiers ('myalias.email ' )))
481
481
->updateBatch ();
482
482
483
483
$ this ->
seeInDatabase (
'user ' , [
'email ' =>
'[email protected] ' ,
'country ' =>
'Germany ' ]);
484
484
}
485
485
486
+ public function testRawSqlConstraintWithKey ()
487
+ {
488
+ if ($ this ->db ->DBDriver === 'SQLite3 ' && ! (version_compare ($ this ->db ->getVersion (), '3.33.0 ' ) >= 0 )) {
489
+ $ this ->markTestSkipped ('Only SQLite 3.33 and newer can complete this test. ' );
490
+ }
491
+
492
+ $ data = [
493
+ [
494
+ 'name ' => 'Derek Jones ' ,
495
+
496
+ 'country ' => 'Germany ' ,
497
+ ],
498
+ ];
499
+
500
+ $ builder = $ this ->db ->table ('user ' );
501
+
502
+ $ builder ->setData ($ data , true , 'myalias ' )
503
+ ->updateFields ('name, country ' )
504
+ ->onConstraint (['email ' => new RawSql ($ this ->db ->protectIdentifiers ('myalias.email ' ))])
505
+ ->updateBatch ();
506
+
507
+ $ this ->
seeInDatabase (
'user ' , [
'email ' =>
'[email protected] ' ,
'country ' =>
'Germany ' ]);
508
+ }
509
+
486
510
public function testNoConstraintFound ()
487
511
{
488
512
$ jobData = [
0 commit comments