console\controllers\MigrateController::actionNew PHP Method

actionNew() public method

This command will show the new migrations that have not been applied. For example, ~~~ yii migrate/new # showing the first 10 new migrations yii migrate/new 5 # showing the first 5 new migrations yii migrate/new 0 # showing all new migrations ~~~
public actionNew ( integer $limit = 10 )
$limit integer the maximum number of new migrations to be displayed. If it is 0, all available new migrations will be displayed.
    public function actionNew($limit = 10)
    {
        $limit = (int) $limit;
        $migrations = $this->getNewMigrations();
        if (empty($migrations)) {
            echo "No new migrations found. Your system is up-to-date.\n";
        } else {
            $n = count($migrations);
            if ($limit > 0 && $n > $limit) {
                $migrations = array_slice($migrations, 0, $limit);
                echo "Showing {$limit} out of {$n} new " . ($n === 1 ? 'migration' : 'migrations') . ":\n";
            } else {
                echo "Found {$n} new " . ($n === 1 ? 'migration' : 'migrations') . ":\n";
            }
            foreach ($migrations as $migration => $alias) {
                echo "    " . $migration . " (" . $alias . ")" . "\n";
            }
        }
    }