framework/console/controllers/BaseMigrateController.php
public function actionFresh()
    {
        if (YII_ENV_PROD) {
            $this->stdout("YII_ENV is set to 'prod'.\nRefreshing migrations is not possible on production systems.\n");
            return ExitCode::OK;
        }

        if ($this->confirm(
            "Are you sure you want to reset the database and start the migration from the beginning?\nAll data will be lost irreversibly!")) {
            $this->truncateDatabase();
            $this->actionUp();
        } else {
            $this->stdout('Action was cancelled by user. Nothing has been performed.');
        }
    }
public function actionFresh()
    {
        if (YII_ENV_PROD) {
            $this->stdout("YII_ENV is set to 'prod'.\nRefreshing migrations is not possible on production systems.\n");
            return ExitCode::OK;
        }

        if ($this->confirm(
            "Are you sure you want to reset the database and start the migration from the beginning?\nAll data will be lost irreversibly!")) {
            $this->truncateDatabase();
            $this->actionUp();
        } else {
            $this->stdout('Action was cancelled by user. Nothing has been performed.');
        }
    }
Truncates the whole database and starts the migration from the beginning.

```
yii migrate/fresh
```

@since 2.0.13