Migration error on Heroku


(Robertnolan) #1

When I run yii migrate on my Heroku instance I get the following error


$ yii migrate

Yii Migration Tool (based on Yii v2.0.12)


Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "db".'


in /app/vendor/yiisoft/yii2/di/Instance.php:139

I have run the init script and set the environment to production. Here is my main-local.php:


<?php

$url = parse_url(getenv("CLEARDB_DATABASE_URL"));

return [

    'components' => [

        'db' => [

            'class' => 'yii\db\Connection',

            'dsn' => 'mysql:host='.$url["host"].';dbname='.substr($url["path"], 1),

            'username' => $url["user"],

            'password' => $url["pass"],

            'charset' => 'utf8',

        ],

        'mailer' => [

            'class' => 'yii\swiftmailer\Mailer',

            'viewPath' => '@common/mail',

        ],

    ],

];

Anyone have any idea what’s happening?


(Satorlous) #2

OFFTOP: Just faced exactly the same problem. Didnt find any solution in google so please let me know if u did.