You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/db/ColumnSchema.php
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -27,18 +27,22 @@ class ColumnSchema extends \yii\db\ColumnSchema
27
27
public$xDbType;
28
28
29
29
/**
30
-
* TODO
31
30
* Used only for MySQL/MariaDB
32
31
* @var array|null
33
32
* [
34
-
* index => int
35
-
* after => ?string
36
-
* before => ?string
33
+
* index => int # position: starts from 1
34
+
* after => ?string # after column
35
+
* before => ?string # before column
37
36
* ]
38
37
* If `before` is null then column is last
38
+
* If `after` is null then column is first
39
+
* If both are null then table has only 1 column
39
40
*/
40
41
public ?array$fromPosition = null;
41
42
public ?array$toPosition = null;
42
43
43
-
publicbool$isPositionReallyChanged = false;
44
+
/**
45
+
* From `$this->fromPosition` and `$this->toPosition` we can check if the position is changed or not. This is done in `BaseMigrationBuilder::setColumnsPositions()`
@@ -246,10 +195,6 @@ public function findPosition(ColumnSchema $column, bool $forDrop = false, bool $
246
195
returnnull;
247
196
}
248
197
249
-
// if (!$forDrop && !isset($columnNames[$key + 1])) { // if new col is added at last then no need to add 'AFTER' SQL part. This is checked as if next column is present or not
250
-
// return null;
251
-
// }
252
-
253
198
if (array_key_exists($prevColName, $forDrop ? $this->tableSchema->columns : $this->newColumns)) {
254
199
if ($forDrop && !$forAlter) {
255
200
// if the previous column is the last one in the want names then no need for AFTER
@@ -275,33 +220,7 @@ public function findPosition(ColumnSchema $column, bool $forDrop = false, bool $
0 commit comments