Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yii2 installation - migrate command not working

I am trying to install yii2 in ubuntu.

yii2 migrate command not working

yii migrate

I am getting Below error

php yii /var/www/event-tracking/migrate
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
Could not open input file: yii
like image 633
Yatin Mistry Avatar asked Jul 02 '14 12:07

Yatin Mistry


People also ask

How do I run a specific migration in yii2?

To run specific migration, you can mark(skip) migrations upto just before one you want run. You can mark migration by using one of following command: Using timestamp to specify the migration yii migrate/mark 150101_185401. Using a string that can be parsed by strtotime() yii migrate/mark "2015-01-01 18:54:01"

What is migration in yii2?

Migration is the base class for representing a database migration. Migration is designed to be used together with the "yii migrate" command. Each child class of Migration represents an individual database migration which is identified by the child class name.


2 Answers

After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.

Execute the init command and select dev as environment.

php /path/to/yii-application/init

Create a new database and adjust the components.db configuration in common/config/main-local.php accordingly.

Apply migrations with console command:

yii migrate

or for windows:

php yii migrate

This command should create the table User,and Migration in your database

ref [Yii2 Documentation]

like image 154
user3797931 Avatar answered Sep 21 '22 11:09

user3797931


If yii migrate isn't working, you can also try php yii migrate as the yii command is just a PHP file that needs to be run.

like image 24
Dylan Hildenbrand Avatar answered Sep 24 '22 11:09

Dylan Hildenbrand