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
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
537
-
returnnull;
538
-
}
539
-
540
-
// in case of `down()` code of migration, putting 'after <colName>' in add column statement is erroneous because <colName> may not exist.
541
-
// Example: From col a, b, c, d, if I drop c and d then their migration code will be generated like:
542
-
// `up()` code
543
-
// drop c
544
-
// drop d
545
-
// `down()` code
546
-
// add d after c (c does not exist! Error!) (TODO check if c is present in newColumn)
547
-
// add c after b (can fix this issue) TODO
548
-
if ($forDrop) {
549
-
// return null; // TODO this case can be fixed
550
-
}
551
-
552
-
if (array_key_exists($prevColName, $this->newColumns)) {
553
-
returnself::POS_AFTER . '' . $prevColName;
554
-
}
555
-
returnnull;
556
-
557
-
// if no `$columnSchema` is found, previous column does not exist. This happens when 'after column' is not yet added in migration or added after currently undertaken column
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
206
+
returnnull;
207
+
}
208
+
209
+
if (array_key_exists($prevColName, $this->newColumns)) {
210
+
returnself::POS_AFTER . '' . $prevColName;
211
+
}
212
+
returnnull;
213
+
214
+
// if no `$columnSchema` is found, previous column does not exist. This happens when 'after column' is not yet added in migration or added after currently undertaken column
0 commit comments