@@ -3127,6 +3127,51 @@ public function testAlgorithmWithMixedCase(): void
31273127 $ this ->assertTrue ($ this ->adapter ->hasColumn ('mixed_case ' , 'col2 ' ));
31283128 }
31293129
3130+ public function testAddColumnWithAlgorithmAndLockSqlContainsClause (): void
3131+ {
3132+ $ table = new Table ('col_sql_verify ' , [], $ this ->adapter );
3133+ $ table ->addColumn ('col1 ' , 'string ' )
3134+ ->create ();
3135+
3136+ $ this ->io ->level (ConsoleIo::VERBOSE );
3137+ $ this ->out ->clear ();
3138+
3139+ $ table ->addColumn ('col2 ' , 'string ' , [
3140+ 'null ' => true ,
3141+ 'algorithm ' => MysqlAdapter::ALGORITHM_INPLACE ,
3142+ 'lock ' => MysqlAdapter::LOCK_NONE ,
3143+ ])->update ();
3144+
3145+ $ output = $ this ->out ->output ();
3146+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3147+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3148+ $ this ->assertTrue ($ this ->adapter ->hasColumn ('col_sql_verify ' , 'col2 ' ));
3149+ }
3150+
3151+ public function testAddColumnWithFluentColumnBuilder (): void
3152+ {
3153+ $ table = new Table ('col_fluent ' , [], $ this ->adapter );
3154+ $ table ->addColumn ('col1 ' , 'string ' )
3155+ ->create ();
3156+
3157+ $ column = new Column ();
3158+ $ column ->setName ('col2 ' )
3159+ ->setType ('string ' )
3160+ ->setNull (true )
3161+ ->setAlgorithm (MysqlAdapter::ALGORITHM_INPLACE )
3162+ ->setLock (MysqlAdapter::LOCK_NONE );
3163+
3164+ $ this ->io ->level (ConsoleIo::VERBOSE );
3165+ $ this ->out ->clear ();
3166+
3167+ $ table ->addColumn ($ column )->update ();
3168+
3169+ $ output = $ this ->out ->output ();
3170+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3171+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3172+ $ this ->assertTrue ($ this ->adapter ->hasColumn ('col_fluent ' , 'col2 ' ));
3173+ }
3174+
31303175 public function testAddIndexWithAlgorithm (): void
31313176 {
31323177 $ table = new Table ('index_algo ' , [], $ this ->adapter );
@@ -3245,7 +3290,7 @@ public function testBatchedIndexesWithSameAlgorithm(): void
32453290 $ this ->assertTrue ($ this ->adapter ->hasIndex ('index_batch ' , ['name ' ]));
32463291 }
32473292
3248- public function testBatchedIndexesWithConflictingAlgorithmsThrowsException ()
3293+ public function testBatchedIndexesWithConflictingAlgorithmsThrowsException (): void
32493294 {
32503295 $ table = new Table ('index_batch_conflict ' , [], $ this ->adapter );
32513296 $ table ->addColumn ('email ' , 'string ' )
@@ -3316,6 +3361,48 @@ public function testAddFulltextIndexWithInstantAndLockThrowsException(): void
33163361 ])->update ();
33173362 }
33183363
3364+ public function testAddIndexWithAlgorithmAndLockSqlContainsClause (): void
3365+ {
3366+ $ table = new Table ('idx_sql_verify ' , [], $ this ->adapter );
3367+ $ table ->addColumn ('email ' , 'string ' )
3368+ ->create ();
3369+
3370+ $ this ->io ->level (ConsoleIo::VERBOSE );
3371+ $ this ->out ->clear ();
3372+
3373+ $ table ->addIndex ('email ' , [
3374+ 'algorithm ' => MysqlAdapter::ALGORITHM_INPLACE ,
3375+ 'lock ' => MysqlAdapter::LOCK_NONE ,
3376+ ])->update ();
3377+
3378+ $ output = $ this ->out ->output ();
3379+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3380+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3381+ $ this ->assertTrue ($ this ->adapter ->hasIndex ('idx_sql_verify ' , ['email ' ]));
3382+ }
3383+
3384+ public function testAddIndexWithFluentIndexBuilder (): void
3385+ {
3386+ $ table = new Table ('idx_fluent ' , [], $ this ->adapter );
3387+ $ table ->addColumn ('email ' , 'string ' )
3388+ ->create ();
3389+
3390+ $ index = new Index ();
3391+ $ index ->setColumns ('email ' )
3392+ ->setAlgorithm (MysqlAdapter::ALGORITHM_INPLACE )
3393+ ->setLock (MysqlAdapter::LOCK_NONE );
3394+
3395+ $ this ->io ->level (ConsoleIo::VERBOSE );
3396+ $ this ->out ->clear ();
3397+
3398+ $ table ->addIndex ($ index )->update ();
3399+
3400+ $ output = $ this ->out ->output ();
3401+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3402+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3403+ $ this ->assertTrue ($ this ->adapter ->hasIndex ('idx_fluent ' , ['email ' ]));
3404+ }
3405+
33193406 public function testInsertOrUpdateWithDuplicates (): void
33203407 {
33213408 $ table = new Table ('currencies ' , [], $ this ->adapter );
0 commit comments