1

Does anyone know if and how a console command from a Yii2 extension can be used with Craft?

To be more specific, I would like to use https://www.yiiframework.com/extension/yii2-migration-creator which is a yii2 extension providing a command to create migrations from existing tables.

However when I composer-require the extension, its command do not appear in Craft console command's list of commands.

1 Answer 1

1

ok, found out how this works:

  • it's not sufficient to composer-require the extension
  • it needs to be activated. for bizley/migration this is done via controllerMap in e.g. app.php (see documentation)
  • you can now create migrations for existing tables, but they are saved to Craft's vendor director (vendor/craftcms/cms/src/migrations/)
  • since this is not the right place, I manually created a migration via Craft's console command, copied the code from vendor/craftcms/cms/src/migrations/, removed the automatically created migration and pasted it into the manually created one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.