Error with migrations: directory does not exist

I’m trying to create a migration for the first time and I get “directory does not exist” error. I’ve read a few topics about the issue and I couldn’t solve it.

I’m using linux and I’m executing the command from the “protected” directory:


php ../framework/yiic migrate create contactoMods

I get the following error:


The migration directory does not exist: application.migrations

Trying to debug where’s the error I modified framework/cli/commands/MigrateCommand.php file to show me which directory is the app actually looking for:


$path=Yii::getPathOfAlias($this->migrationPath);

if($path===false || !is_dir($path))

    die('Error: The migration directory does not exist: '.$path."\n");

    //it was: die('Error: The migration directory does not exist: '.$this->migrationPath."\n");

Now I get this weird error:


Error: The migration directory does not exist: /home/attilio/Documenti/Development/contactos/framework/cli/migrations

Why is the application looking fot "migrations" directory under "framework/cli"? It should point to "protected/migrations"

Just for reference, this is my protected/config/console.php (I didn’t change it, it’s the default from the v1.1.8 release)


'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

It’s recommended in the guide that you should use the applications instance of yiic.

Try without php ../framework and just type yiic migrate create contactoMods.

/Tommy

done; I always get the same error :(

I can’t find it in the documentation now, but I think the directory has to exist (and be writable).

/Tommy

You should create directory protected/migrations and give "write" permissions to it.

Done already! directory is there by default and I’m running the php command with the same user that owns the directory. The problem is not writing permissions, but which directory is the app looking for, as I wrote in my first post.

Other suggestions??

[font="arial, verdana, tahoma, sans-serif"][size="2"]

Code from framework/yiic.php:[/size][/font]





if(isset($config))

{

	$app=Yii::createConsoleApplication($config);

	//...

}

else

	$app=Yii::createConsoleApplication(array('basePath'=>dirname(__FILE__).'/cli'));



Make sure that protected/yiic.php contains the following line :


$config=dirname(__FILE__).'/config/console.php';

and (as tri already recommended) always execute protected/yiic rather than protected/framework/yiic.

yiick! I didn’t even notice there are two yiic, one in protected/ and the other in framework/ ! I was using the wrong one!

Thanks everybody for answering me!

Where is the second yiic i have only one yiic thats in the framework folder only… i don’t have the protected folder nor i was aware of such… Can you guide me what you have done. i’m having the same error and unable to get rid of it.

Follow this guide - http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app - to create new application within protected/ folder.

Thank you, that worked for me. You have to use your applications yiic which makes sense afterall =)