simialbi/yii2-kanban

Can't apply migrations

nedarta opened this issue · 9 comments

Can't apply migrations (Btw - there isn't documentation about migrations)
PHP 7.2.7
Latest Yii2 Advanced template

php yii migrate --migrationPath=@vendor/simialbi/yii2-kanban/src/migrations

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

You have to do via namespace:
yii migrate --migration-namespaces='simialbi\yii2\kanban\migrations' should work. Alternative configure your console application like this:

[
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'simialbi\yii2\ticket\migrations'
            ]
        ]
    ]
]

Thanks. Almoast everything went fine with (tables are created):
yii migrate --migration-namespaces='simialbi\yii2\kanban\migrations'

Except this pops up:

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

in C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\di\Container.php:449

Could you paste the full stack trace?
What do you have for a configuration (PHP 7.2 and which DB Engine? On which OS?)

php yii migrate --migration-namespaces='simialbi\yii2\kanban\migrations'
Yii Migration Tool (based on Yii v2.0.32)

Total 4 new migrations to be applied:
        m190729_140638_add_link_table
        simialbi\yii2\kanban\migrations\m190729_140638_add_link_table
        m191217_112935_add_ticket_module_link
        simialbi\yii2\kanban\migrations\m191217_112935_add_ticket_module_link

Apply the above migrations? (yes|no) [no]:yes
*** applying m190729_140638_add_link_table
Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "m190729_140638_add_link_table".'

in C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\di\Container.php:449

Stack trace:
#0 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\di\Container.php(374): yii\di\Container->getDependencies('m190729_140638_...')
#1 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\di\Container.php(159): yii\di\Container->build('m190729_140638_...', Array, Array)
#2 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\BaseYii.php(365): yii\di\Container->get('m190729_140638_...', Array, Array)
#3 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\console\controllers\MigrateController.php(202): yii\BaseYii::createObject(Array)
#4 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(724): yii\console\controllers\MigrateController->createMigration('m190729_140638_...')
#5 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(200): yii\console\controllers\BaseMigrateController->migrateUp('m190729_140638_...')
#6 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#7 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#8 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#9 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\console\Controller.php(164): yii\base\Controller->runAction('', Array)
#10 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\base\Module.php(528): yii\console\Controller->runAction('', Array)
#11 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction('migrate', Array)
#12 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction('migrate', Array)
#13 C:\Users\edgar\PhpstormProjects\kanban-test\vendor\yiisoft\yii2\base\Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#14 C:\Users\edgar\PhpstormProjects\kanban-test\yii(23): yii\base\Application->run()
#15 {main}

Win10, PHP 7.2.7, MySQL 5.7.11. Is there any specific needed about PHP? All main extensions are enabled.

Yii Application Requirement Checker

This script checks if your server configuration meets the requirements
for running Yii application.
It checks if the server is running the right version of PHP,
if appropriate PHP extensions have been loaded, and if php.ini file settings are correct.

Check conclusion:
-----------------

PHP version: OK

Reflection extension: OK

PCRE extension: OK

SPL extension: OK

Ctype extension: OK

MBString extension: OK

OpenSSL extension: OK

Intl extension: OK

ICU version: OK

ICU Data version: OK

Fileinfo extension: OK

DOM extension: OK

IPv6 support: OK

PDO extension: OK

PDO SQLite extension: OK

PDO MySQL extension: OK

PDO PostgreSQL extension: WARNING!!!
Required by: All DB-related classes
Memo: Required for PostgreSQL database.

Memcache extension: WARNING!!!
Required by: MemCache

APC extension: WARNING!!!
Required by: ApcCache

GD PHP extension with FreeType support: OK

ImageMagick PHP extension with PNG support: WARNING!!!
Required by: Captcha
Memo: Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.

Expose PHP: WARNING!!!
Required by: Security reasons
Memo: "expose_php" should be disabled at php.ini

PHP allow url include: OK

PHP mail SMTP: OK

You have to remove the path (it seems like you still have the migrationPath pointing to @vendor/simialbi[...]). That's why it shows each migration twice and it can't apply the one not loaded via migrationNamespace

You have to remove the path (it seems like you still have the migrationPath pointing to @vendor/simialbi[...]). That's why it shows each migration twice and it can't apply the one not loaded via migrationNamespace

Can confirm. My lame "meh, let's copy to the console all that stuff" fault. Anyway - there's quite a lot thing going on in frontend, so - "I'll be back" with merge requests.

Thank you and have a nice one!

That's ok. I appreciate contributions. Thank you

You have to do via namespace:
yii migrate --migration-namespaces='simialbi\yii2\kanban\migrations' should work. Alternative configure your console application like this:

[
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'simialbi\yii2\ticket\migrations'
            ]
        ]
    ]
]

please add this to howto, thanks

Done