<p>ok, found out how this works:</p>
<ul>
<li>it's not sufficient to composer-require the extension</li>
<li>it needs to be activated. for bizley/migration this is done via controllerMap in e.g. app.php (see documentation)</li>
<li>you can now create migrations for existing tables, but they are saved to Craft's vendor director (vendor/craftcms/cms/src/migrations/)</li>
<li>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.</li>
</ul>

CC BY-SA 4.0
2021-01-30T19:25:44.287Z
2021-01-30T19:25:44.287Z
Matthias Redl-Mann
<p>Does anyone know if and how a console command from a Yii2 extension can be used with Craft?</p>
<p>To be more specific, I would like to use
<a href="https://www.yiiframework.com/extension/yii2-migration-creator" rel="nofollow noreferrer">https://www.yiiframework.com/extension/yii2-migration-creator</a>
which is a yii2 extension providing a command to create migrations from existing tables.</p>
<p>However when I composer-require the extension, its command do not appear in Craft console command's list of commands.</p>

<console><commands>
execute Yii2 console command from Yii2 extension with Craft
# execute Yii2 console command from Yii2 extension with Craft

(Asked by: username_0 on 2021-01-28)

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.

**Tags:** console, commands

---

## 1 answers

### Answer by username_0 on 2021-01-30. Score: 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.


---

