66
77use yii \base \BaseObject ;
88use yii \base \InvalidConfigException ;
9+ use yii \db \Connection ;
910
1011/**
1112 * Class TableChange
@@ -36,6 +37,12 @@ class TableChange extends BaseObject
3637 */
3738 public $ schema ;
3839
40+ /**
41+ * @var Connection
42+ * @since 3.6.0
43+ */
44+ public $ db ;
45+
3946 /**
4047 * Returns change value.
4148 * @return array|string|TableColumn|TablePrimaryKey|TableForeignKey|TableIndex
@@ -52,6 +59,7 @@ public function getValue()
5259 'schema ' => $ this ->schema ,
5360 'name ' => $ column ,
5461 'type ' => $ schema ['type ' ],
62+ 'defaultMapping ' => $ this ->db ->schema ->queryBuilder ->typeMap [$ schema ['type ' ]],
5563 'length ' => $ schema ['length ' ] ?? null ,
5664 'isNotNull ' => $ schema ['isNotNull ' ] ?? null ,
5765 'isUnique ' => $ schema ['isUnique ' ] ?? null ,
@@ -61,6 +69,8 @@ public function getValue()
6169 'append ' => $ schema ['append ' ] ?? null ,
6270 'isUnsigned ' => $ schema ['isUnsigned ' ] ?? null ,
6371 'comment ' => !empty ($ schema ['comment ' ]) ? $ schema ['comment ' ] : null ,
72+ 'after ' => $ schema ['after ' ] ?? null ,
73+ 'isFirst ' => $ schema ['isFirst ' ] === true ,
6474 ]);
6575 }
6676 return $ columns ;
@@ -77,6 +87,7 @@ public function getValue()
7787 'schema ' => $ this ->schema ,
7888 'name ' => $ this ->data [0 ],
7989 'type ' => $ this ->data [1 ]['type ' ],
90+ 'defaultMapping ' => $ this ->db ->schema ->queryBuilder ->typeMap [$ this ->data [1 ]['type ' ]],
8091 'length ' => $ this ->data [1 ]['length ' ] ?? null ,
8192 'isNotNull ' => $ this ->data [1 ]['isNotNull ' ] ?? null ,
8293 'isUnique ' => $ this ->data [1 ]['isUnique ' ] ?? null ,
@@ -86,6 +97,8 @@ public function getValue()
8697 'append ' => $ this ->data [1 ]['append ' ] ?? null ,
8798 'isUnsigned ' => $ this ->data [1 ]['isUnsigned ' ] ?? null ,
8899 'comment ' => !empty ($ this ->data [1 ]['comment ' ]) ? $ this ->data [1 ]['comment ' ] : null ,
100+ 'after ' => $ this ->data [1 ]['after ' ] ?? null ,
101+ 'isFirst ' => $ this ->data [1 ]['isFirst ' ] === true ,
89102 ]);
90103
91104 case 'addPrimaryKey ' :
0 commit comments