I can't run migrations.
carlos-andres opened this issue · 6 comments
Good day, and thanks in advance. .I would like some help
i try to run
./yii migrate/up --migrationPath=@bedezign/yii2/audit/migrations
but i got the message
Exception 'yii\base\InvalidArgumentException' with message 'Invalid path alias: @bedezign/yii2/audit/migrations'
my Yii version is: (using composer show yiisoft/yii2
)
name : yiisoft/yii2
descrip. : Yii PHP Framework Version 2
keywords : framework, yii2
versions : * 2.0.36
and the package version is: ( using composer show bedezign/yii2-audit
)
name : bedezign/yii2-audit
descrip. : Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.
keywords : Audit, logging, trail, yii2
versions : * 1.1.2
php version 7.2
also the config file (console/config/console.php) is
return [
'id' => 'console',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'console\controllers',
'controllerMap' => [
'command-bus' => [
'class' => trntv\bus\console\BackgroundBusController::class,
],
'message' => [
'class' => console\controllers\ExtendedMessageController::class
],
'migrate' => [
'class' => yii\console\controllers\MigrateController::class,
'migrationPath' => '@common/migrations/db',
'migrationTable' => '{{%system_db_migration}}'
],
'rbac-migrate' => [
'class' => console\controllers\RbacMigrateController::class,
'migrationPath' => '@common/migrations/rbac/',
'migrationTable' => '{{%system_rbac_migration}}',
'templateFile' => '@common/rbac/views/migration.php'
],
],
];
Any help is really appreciated! ..
Try it:
'migrate' => [
'class' => yii\console\controllers\MigrateController::class,
'migrationPath' => [
'@common/migrations/db',
'@vendor/bedezign/yii2-audit/src/migrations',
],
'migrationTable' => '{{%system_db_migration}}'
],
@juniorari Thanks a lot..
Cool one step closer..
also i try to run migration directly from the vendor source ... and got same error instantiate component or class
php console/yii migrate/up --migrationPath=vendor/bedezign/yii2-audit/src/migrations
./yii migrate
Yii Migration Tool (based on Yii v2.0.38)
Total 8 new migrations to be applied:
m150626_000001_create_audit_entry
m150626_000002_create_audit_data
m150626_000003_create_audit_error
m150626_000004_create_audit_trail
m150626_000005_create_audit_javascript
m150626_000006_create_audit_mail
m150714_000001_alter_audit_data
m170126_000001_alter_audit_mail
Apply the above migrations? (yes|no) [no]:yes
*** applying m150626_000001_create_audit_entry
Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "m150626_000001_create_audit_entry".'
in {.......}/vendor/yiisoft/yii2/di/Container.php:455
Caused by: Exception 'ReflectionException' with message 'Class m150626_000001_create_audit_entry does not exist'
in {.......}vendor/yiisoft/yii2/di/Container.php:453
but files are there
@juniorari Thanks a lot..
Cool one step closer..
also i try to run migration directly from the vendor source ... and got same error instantiate component or class
php console/yii migrate/up --migrationPath=vendor/bedezign/yii2-audit/src/migrations
./yii migrate Yii Migration Tool (based on Yii v2.0.38) Total 8 new migrations to be applied: m150626_000001_create_audit_entry m150626_000002_create_audit_data m150626_000003_create_audit_error m150626_000004_create_audit_trail m150626_000005_create_audit_javascript m150626_000006_create_audit_mail m150714_000001_alter_audit_data m170126_000001_alter_audit_mail Apply the above migrations? (yes|no) [no]:yes *** applying m150626_000001_create_audit_entry Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "m150626_000001_create_audit_entry".' in {.......}/vendor/yiisoft/yii2/di/Container.php:455 Caused by: Exception 'ReflectionException' with message 'Class m150626_000001_create_audit_entry does not exist' in {.......}vendor/yiisoft/yii2/di/Container.php:453
guys, any update on this?? I also face same problem, can't run migration..
Fixed in 1.2.6, see https://github.com/bedezign/yii2-audit?tab=readme-ov-file#yii2-audit-12x