Isuru Sanjana
Isuru Sanjana

Reputation: 91

Yii2 Migrations command not recognizing

I want to run my new migration, before that I checked for new migration using "PHP Yii migrate" command. It gives me

...\common\config\params.php on line 13 Error: Unknown command "migration".

My params file :

$fullUrl = 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

if (strpos($fullUrl,'/frontend') !== false) {
    $webUrl = explode('/frontend', $fullUrl);
    $value = $webUrl[0].'/frontend/web';
} else if (strpos($fullUrl,'/backend') !== false) {
    $webUrl = explode('/backend', $fullUrl);
    $value = $webUrl[0].'/backend/web';
} else {
    $value = 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST'];
}

$advertisementUrl = str_replace('admin.', '', $value);

return [
    'adminEmail' => '[email protected]',
    'supportEmail' => '[email protected]',
    'advertisement' => $advertisementUrl,
    'user.passwordResetTokenExpire' => 3600,
    'currentWebsiteUrl' => $value,
    'hash' => 'cba',
    'newsfeedOffset' => 20
];

Upvotes: 1

Views: 311

Answers (1)

Muhammad Omer Aslam
Muhammad Omer Aslam

Reputation: 23738

To run the migrations go to the root directory of your project and run the command

./yii migrate 

and to create a migration you should

./yii migrate/create myMigrationName

Upvotes: 1

Related Questions