File tree Expand file tree Collapse file tree 6 files changed +19
-15
lines changed Expand file tree Collapse file tree 6 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -638,20 +638,21 @@ public function addColumn(
638
638
'unsigned ' => null ],
639
639
$ options
640
640
);
641
-
642
- $ sql = sprintf (
643
- 'ALTER TABLE %s ADD %s %s ' ,
644
- $ this ->quoteTableName ($ tableName ),
645
- $ this ->quoteColumnName ($ columnName ),
646
- $ this ->typeToSql (
641
+ $ sqlType = $ this ->typeToSql (
647
642
$ type ,
648
643
$ options ['limit ' ],
649
644
$ options ['precision ' ],
650
645
$ options ['scale ' ],
651
646
$ options ['unsigned ' ]
652
- )
653
647
);
654
- $ sql = $ this ->addColumnOptions ($ sql , $ options );
648
+
649
+ $ sql = sprintf (
650
+ 'ALTER TABLE %s ADD %s %s ' ,
651
+ $ this ->quoteTableName ($ tableName ),
652
+ $ this ->quoteColumnName ($ columnName ),
653
+ $ sqlType
654
+ );
655
+ $ sql = $ this ->addColumnOptions ($ sql , $ options , $ sqlType );
655
656
656
657
return $ this ->execute ($ sql );
657
658
}
@@ -986,7 +987,7 @@ public function typeToSql(
986
987
*
987
988
* @return string The manipulated SQL definition.
988
989
*/
989
- public function addColumnOptions ($ sql , $ options )
990
+ public function addColumnOptions ($ sql , $ options, string $ sqlType = '' )
990
991
{
991
992
/* 'autoincrement' is not handled here - it varies too much between
992
993
* DBs. Do autoincrement-specific handling in the driver. */
Original file line number Diff line number Diff line change @@ -566,12 +566,15 @@ public function typeToSql(
566
566
*
567
567
* @return string The manipulated SQL definition.
568
568
*/
569
- public function addColumnOptions ($ sql , $ options )
569
+ public function addColumnOptions ($ sql , $ options, string $ sqlType = '' )
570
570
{
571
- $ sql = parent ::addColumnOptions ($ sql , $ options );
571
+ $ sql = parent ::addColumnOptions ($ sql , $ options, $ sqlType );
572
572
if (isset ($ options ['after ' ])) {
573
573
$ sql .= ' AFTER ' . $ this ->quoteColumnName ($ options ['after ' ]);
574
574
}
575
+ if (isset ($ options ['default ' ])) {
576
+ $ options ['default ' ] = self ::filterDefault ($ options ['default ' ], $ sqlType );
577
+ }
575
578
if (!empty ($ options ['autoincrement ' ])) {
576
579
$ sql .= ' AUTO_INCREMENT ' ;
577
580
}
Original file line number Diff line number Diff line change @@ -862,7 +862,7 @@ public function currentDatabase()
862
862
*
863
863
* @return string The manipulated SQL definition.
864
864
*/
865
- public function addColumnOptions ($ sql , $ options )
865
+ public function addColumnOptions ($ sql , $ options, string $ sqlType = '' )
866
866
{
867
867
/* 'autoincrement' is not handled here - it varies too much between
868
868
* DBs. Do autoincrement-specific handling in the driver. */
Original file line number Diff line number Diff line change @@ -1003,7 +1003,7 @@ public function typeToSql(
1003
1003
*
1004
1004
* @return string The manipulated SQL definition.
1005
1005
*/
1006
- public function addColumnOptions ($ sql , $ options )
1006
+ public function addColumnOptions ($ sql , $ options, string $ sqlType = '' )
1007
1007
{
1008
1008
/* 'autoincrement' is not handled here - it varies too much between
1009
1009
* DBs. Do autoincrement-specific handling in the driver. */
Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ public function typeToSql(
550
550
*
551
551
* @return string The manipulated SQL definition.
552
552
*/
553
- public function addColumnOptions ($ sql , $ options )
553
+ public function addColumnOptions ($ sql , $ options, string $ sqlType = '' )
554
554
{
555
555
$ sql = parent ::addColumnOptions ($ sql , $ options );
556
556
if (isset ($ options ['after ' ])) {
Original file line number Diff line number Diff line change @@ -869,7 +869,7 @@ public function currentDatabase()
869
869
*
870
870
* @return string The manipulated SQL definition.
871
871
*/
872
- public function addColumnOptions ($ sql , $ options )
872
+ public function addColumnOptions ($ sql , $ options, string $ sqlType = '' )
873
873
{
874
874
/* 'autoincrement' is not handled here - it varies too much between
875
875
* DBs. Do autoincrement-specific handling in the driver. */
You can’t perform that action at this time.
0 commit comments