Commit 33edfcff by Carsten Brandt

Use `limit(null)` instead of `limit(-1)`

in migration controller to be compatible to more backends fixes #3947
parent c0a15ded
...@@ -174,6 +174,7 @@ Yii Framework 2 Change Log ...@@ -174,6 +174,7 @@ Yii Framework 2 Change Log
- Chg: Removed `yii\rest\ActiveController::$transactional` property and connected functionality (samdark) - Chg: Removed `yii\rest\ActiveController::$transactional` property and connected functionality (samdark)
- Chg: Changed the default value of the `keyPrefix` property of cache components to be null (qiangxue) - Chg: Changed the default value of the `keyPrefix` property of cache components to be null (qiangxue)
- Chg: Added `prefix` column to `yii\log\DbTarget` to have the same amount of information logged as in files and emails (cebe) - Chg: Added `prefix` column to `yii\log\DbTarget` to have the same amount of information logged as in files and emails (cebe)
- Chg: Use `limit(null)` instead of `limit(-1)` in migration controller to be compatible to more backends (cebe)
- New #3911: Added `yii\behaviors\SluggableBehavior` that fills the specified model attribute with the transliterated and adjusted version to use in URLs (creocoder) - New #3911: Added `yii\behaviors\SluggableBehavior` that fills the specified model attribute with the transliterated and adjusted version to use in URLs (creocoder)
......
...@@ -328,7 +328,7 @@ abstract class BaseMigrateController extends Controller ...@@ -328,7 +328,7 @@ abstract class BaseMigrateController extends Controller
} }
// try mark down // try mark down
$migrations = array_keys($this->getMigrationHistory(-1)); $migrations = array_keys($this->getMigrationHistory(null));
foreach ($migrations as $i => $migration) { foreach ($migrations as $i => $migration) {
if (strpos($migration, $version . '_') === 0) { if (strpos($migration, $version . '_') === 0) {
if ($i === 0) { if ($i === 0) {
...@@ -544,7 +544,7 @@ abstract class BaseMigrateController extends Controller ...@@ -544,7 +544,7 @@ abstract class BaseMigrateController extends Controller
protected function migrateToTime($time) protected function migrateToTime($time)
{ {
$count = 0; $count = 0;
$migrations = array_values($this->getMigrationHistory(-1)); $migrations = array_values($this->getMigrationHistory(null));
while ($count < count($migrations) && $migrations[$count] > $time) { while ($count < count($migrations) && $migrations[$count] > $time) {
++$count; ++$count;
} }
...@@ -575,7 +575,7 @@ abstract class BaseMigrateController extends Controller ...@@ -575,7 +575,7 @@ abstract class BaseMigrateController extends Controller
} }
// try migrate down // try migrate down
$migrations = array_keys($this->getMigrationHistory(-1)); $migrations = array_keys($this->getMigrationHistory(null));
foreach ($migrations as $i => $migration) { foreach ($migrations as $i => $migration) {
if (strpos($migration, $version . '_') === 0) { if (strpos($migration, $version . '_') === 0) {
if ($i === 0) { if ($i === 0) {
...@@ -598,7 +598,7 @@ abstract class BaseMigrateController extends Controller ...@@ -598,7 +598,7 @@ abstract class BaseMigrateController extends Controller
protected function getNewMigrations() protected function getNewMigrations()
{ {
$applied = []; $applied = [];
foreach ($this->getMigrationHistory(-1) as $version => $time) { foreach ($this->getMigrationHistory(null) as $version => $time) {
$applied[substr($version, 1, 13)] = true; $applied[substr($version, 1, 13)] = true;
} }
...@@ -621,7 +621,7 @@ abstract class BaseMigrateController extends Controller ...@@ -621,7 +621,7 @@ abstract class BaseMigrateController extends Controller
/** /**
* Returns the migration history. * Returns the migration history.
* @param integer $limit the maximum number of records in the history to be returned * @param integer $limit the maximum number of records in the history to be returned. `null` for "no limit".
* @return array the migration history * @return array the migration history
*/ */
abstract protected function getMigrationHistory($limit); abstract protected function getMigrationHistory($limit);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment