database migration error in Yii - 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

Related

Get error in Lumen database migration after delete migration file manually

Below is the step that I followed.
php artisan migrate:install
php artisan make:migration create_categories_table --create=categories
So it's create migration table in database.
it's create 2016_11_24_054214_create_categories_table.php file in database/migrations folder with some basic stuff. I have added my columns information and run next command php artisan migrate so my table is created successfully.
Now I have deleted 2016_11_24_054214_create_categories_table.php file manually and delete categories table from database then I tried to create same categories table using same last command php artisan make:migration create_categories_table --create=categories but it's give me a below error.
[ErrorException]
include(/var/www/news_reporting/vendor/composer/../../database/migrations/2016_11_24_054214_create_categories_table.php): failed to open stream: No such file or directory
I googled and found one solution that run php composer dump-autoload command but this command give me below error.
Could not open input file: composer
I am using linux.
Could not open input file: composer
Please make sure that composer is installed in your system.
To check just go to terminal and write command composer if it is installed then you will see some stuff else you will get composer not found error
If above is a issue then you need to install composer in your system user this link for installing reference.
Or you might need to run php artisan migrate command for migrating migrations.
you don't need to precede composer with PHP command, try it this way:
composer dump-autoload
and that should solve your migration problem.

SQL error in Laravel when moving project between machines

I just moved my laravel project from one machine to another.
What I didn was:
-Create a new Laravel Homestead machine.
-Copy all files from my laravel app's folder
The website serves ok from my new machine but any database dependant operation fails because the tables aren't created in my new server. The error is the following:
QueryException in Connection.php line 673: SQLSTATE[42S02]: Base table or view not found:
The migrations are present in my new machine but I cant do a
php artisan migrate
or a
php artisan migrate:refresh
since both return
[Symfony\Component\Debug\Exception\FatalErrorException]
Cannot declare class CreateUsersTable, because the name is already in use
I've spent so much time here I don't know what to do.
delete all the tables from the database manually including the migrations table and run php artisan migrate

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.

Yii Database Migration

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.

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