Yii Database Migration - yii

Hello guys I am new to yii frame work and I am following larry ullman's instructions
on the e-book.
The problem I have is: when I'm creating new migration I keep on getting this error
The migration directory does not exists:application.migrations
I use the command : $ yiic migrate create <name>
Thank you guys for helping me understand yii.

I have noticed that the answer for this issue have been answered in the comments section, but may not be noticable for others.
Just to summarize:
You need to execute the yiic inside the protected directory
There should be an yiic.bat inside the protected directory
In some cases, the migration directory inside the protected directory must be available beforehand and is writable.

Related

Migrating Trac Wiki

I am trying to move Trac data from an old server at my workplace to a new server but I am stuck on the last step of migrating our wiki data. We use Trac 1.0.1 and are trying to update to Trac 1.2. The part I am stuck on is dumping the wiki. I have been trying to use
trac-admin wiki dump
This works for my tests but when I try to use it on the actual wiki I get an error saying that the filename is too long. This happens because the hierarchical files try to make a filename like this
child1%2child2%2child3%2child4%2child5%2.....
instead of
child1/child2/child3/child4/child5/.....
Since linux is seeing this path as one name it throws an error saying that the file name is too long. Has anyone ran into this problem before and have a solution for it????
I have also tried making a hotcopy of trac and transfering it but this doesnt work either. If anyone knows where the wikis are stored and how to copy that from our old server to our new server that would be the most optimal solution I am looking for

Yii framework getting error in configuration

I am trying to configure my Yii framework and I am stuck in one step. I run command yiic webapp ..\..\yiitestapp and "many" of these to start the app but I got a same error every time.
yii is not recognized as an internal or external command,operable program and batch file
I also set my environmental variable as ";D:\xampp\php"
And my Yiiframework location is "D:\Xampp\htdocs\yiiframework\yiiframework"
Can any one guide me for the right solution?
You need to run yiic webapp ....\yiitestapp from the Yii\framework folder.

"Execute Code First Migrations" checkbox disappeared from my publish profile

I'm using web deploy to deploy an MVC4 application using EF5 code first. I made a publish profile called "development" that uses web deploy for application and database using the 'Execute Code First Migrations' checkbox to run migrations on application startup. The publishing worked great for a while. At some point I added a new publish profile called "test" to deploy to another server, which uses the ftp method of deploy and no automatic migrations. This works fine too. However, when I tried to use my old "development" publish profile again, VS changes the settings automatically to the dbDacFx way ('Update database' checkbox instead of 'Execute Code First Migrations') and I can't get it back to the way it was.
There were some other changes to the project while using the 'Test' profile, but nothing that seems to me like it could cause this. Does anyone know why VS thinks my project doesn't use code first anymore?
Since asking this question, I've run into this problem several more times in multiple versions of MVC and EF (all code first though of cource). When it happens, don't save the changes to your publish profile, make sure you are on the 'debug' build configuration, clean solution and rebuild solution. And if all that fails, restart Visual Studio and try again.
So far, this has always solved the problem for me.
Here is the right answer - is solved the problem for me.
Just rename your connection string exactly as your DbContext, e.g.
public ApplicationDbContext()
: base("Vocabulary.Domain.ApplicationDbContext", throwIfV1Schema: false)
{
}
Note that name should include namespace like "Vocabulary.Domain.ApplicationDbContext".
Don't forget to update .pubxml files:
<ObjectGroup Name="Vocabulary.Domain.ApplicationDbContext" Order="1" Enabled="True">
This article describes when publish dialog has or has no the tick "Execute Code First Migrations (runs on application start)"
This happened to me in VS2013. Neither cleaning the solution, nor restarting it worked. I tried to "re-enable" migrations and it worked. Even though I got an error message that migrations have already been enabled in project, the "Execute Code First Migrations" checkbox appeared again.
Since nothing mentioned above worked.
I downloaded the publish profile from azure and it worked flawlessly the first time
I had this problem and for me it had a different cause to any I've found documented elsewhere.
My application is spread over many projects in a solution. As I use interfaces and a separate View/Presentation model to wrap calls to the database, my front web project had no direct reference to the project containing the DbContext class. Note that this posed no problem to my running the site locally. I do this so that developers in the front end web project are not tempted to bypass the Presentation layer and go more directly to the database.
Adding this reference immediately fixed the problem and now I see the 'Execute Code First Migrations' checkbox in my Publish Profile dialog.
Just to add to the mix, don't call your Connection Class DbConn didn't seem to like that.

database migration error in Yii

I am newbie to yii. I have made database in MySQL.After that I want to migrate the database.So for that I made a folder called migration under protected and from framework folder whenever I am writing command yiic migrate create --name=add_table in terminal.It is showing error like yiic: command not found
I am using ubuntu 11.04.So what is the problem behind that.
cd down to the folder containing the yiic file and try the command then. If that doesn't work try to put "php" in front of the command like:
php yiic migrate create --name=add_table
Or you could try:
./yiic

yiic webapp problem

i'm still new to yii framework.
so, i want to try running yiic so that i could see the structure of the files created.
but, i could not run it in console. Does anyone have a solution? thanks.
I'm using wamp on win xp.
i go to the directory of the yiic framework
its in D:\wamp\www\framework\
and run yiic and any other variations per Larry Ullman's blog. but still got: "..." is not a recognizable internal/ external command...
How should i be able to run yiic? thanks.
just read this:
http://www.yiiframework.com/doc/cookbook/3/
:)
It's always better to follow yii official documentation.
You can find Installing Yii process step by step here
documentation> tutorial > The Yii Blog Tutorial > Testdriving with
Yii # Installing Yii
here is the link http://www.yiiframework.com/doc/blog/1.1/en/start.testdrive#installing-yii
If you getting this kind of error when you try to use yiic webapp ..\app-name
'"php.exe"' is not recognized as an internal or external command,
operable program or batch file.
Open the yiic.bat file under yii framework folder ( C:\wamp\www\framework ) and change the bellow line
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
to
if "%PHP_COMMAND%" == "" set PHP_COMMAND=C:\wamp\bin\php\php5.4.16\php.exe
php5.4.16 this might be change accroding to you php version, please check in C:\wamp\bin\php folder before change
Cheers