Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Failed to open stream" error, when creating new migration

I'm trying to use the yii migration system but I'm stuck on this error when I execute this command:

   ./yiic migrate create basic_data_migrate

I get this error:

PHP Error[2]: file_get_contents(C:\Bitnami\wappstack-5.4.28-0\apache2\htdocs\cv360\protected\migrations\template.php): failed to open stream: No such file or directory
    in file C:\Bitnami\wappstack-5.4.28-0\apache2\htdocs\yii\framework\cli\commands\MigrateCommand.php at line 555

What is this template.php? How to solve this problem.

like image 326
Dhinesh.B Avatar asked Feb 24 '26 13:02

Dhinesh.B


1 Answers

When generating a new Migration file the Migration command is using a template to create a php file with the basic instructions.

By default Yii is using its own template file but you can define your own. In your case it seems that you set the templateFile param but you havn't any template.

In your configuration file find something like :

'commandMap' => array(
        'migrate' => array(
            'class' => 'system.cli.commands.MigrateCommand',
            'migrationPath' => 'application.migrations',
            'templateFile' => 'application.migrations.template'//This should be removed
        )
    ),

And remove the line templateFile

like image 89
darkheir Avatar answered Feb 26 '26 04:02

darkheir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!