1

I am learning database migration in Yii2. I am trying to create a new migration class create_news_table using command through composer.

I installed composer globally and running command

yii migrate/create create_news_table

I copied this command from yii2 official site Yii2 Db Migration

But after running command i got this error

Unknown command: migrate\create Did you mean "migrate/create"?

However i have written "migrate/create" not "migrate\create". Then why it is showing this error?

Ninja Turtle
  • 1,293
  • 2
  • 24
  • 50

3 Answers3

2

Please try this:

php yii migrate/create create_news_table
1

I was writing correct syntax. But the problem was with my composer.

I updated composer using composer update command and now it is working.

shareef
  • 9,255
  • 13
  • 58
  • 89
Ninja Turtle
  • 1,293
  • 2
  • 24
  • 50
0

You have to escape / (slash). Try this:

yii migrate\/create create_news_table
Rendy Eko Prastiyo
  • 1,068
  • 7
  • 16