SQL error in Laravel when moving project between machines - sql

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

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.

How to install PrestaShop 1.7 RC0 from Composer

I've just cloned the RC0 of PrestaShop 1.7.
I've run composer install but... what to do now?
I've tried to start the server with app/console server:start but, going to 127.0.0.1:8000 i receive this error:
Front not yet implemented! Or to delete...
So, this seems not to be right way:
app/console server:stop
and try another way...
Go with the classic localhost:
Link to database cannot be established: SQLSTATE[HY000] [1049] Unknown
database 'dev-prestashop-1_7'
Ok, I've to create the database... Database dev-prestashop-1_7 created... Try again...
Table 'dev-prestashop-1_7.ps_shop_url' doesn't exist
Yes, it's normal that it doesn't exists: I've not yet created it!
But, now comes the question: how I configure PrestaShop?
How can I start the installation procedure using the composer version of PrestaShop 1.7 RC0?
Once you have downloaded the zip of prestashop, you have to unzip it in a specified repo and give it the needed permissions. Then, you acces to this repo in a chosen browser.
For example (if you are under Linux system), let's say that your repo is called prestashop_1.7 and is put in /var/html/www, so you access to localhost/prestashop_1.7.
When accessing to this URL, un install unzipper will start and when finishing unzipping, it will lead you to the installation configuration.
You enter your configuration (you have to create the database manually) and that's it!

Entity Framework MVC code first, migration to production server

I've created a project using EF Version 6.0, with settings of AutomaticMigrationsEnabled = true;
Which worked fine, i could able to deploy in production server on first time, It created desire database tables.
Now for second update, I've get script out from migration so that i can able to run in production server. but i tried many Package Manager commands, but it does creating empty .sql files.
My second Migration has name "201601181549424_Version-1.2.0", i used following sequence of steps and commands to generate .sql file.
Added desire data classes (which will be creating tables in database) and MVC views and controller.
Run Package Manger Command is "ADD-MIGRATION Version-1.2.0" has created 201601181549424_Version-1.2.0" file in Migration folder
Than "UPDATE-DATABASE" - has updated local database, check everything works fine.
Than "UPDATE-DATABASE -Script" - has created empty.sql file. I am looking to get sql file with creation of database tables in sql file.
Can you please help me understand how i can deploy this in production database.
Thanks,
I figured out by this way..
Make desire changes to model, (INSERT OR UPDATE MODEL)
Add-Migration
Update-Database -Script
(Which will create script and can store for QA or production deployment purpose)
Update-Database
(Above command will update model in to local database)

Laravel3 migration on production server error: SQLSTATE[HY000] [2002] No such file or directory

I tried my database migration in fortrabbit.com through SSH, but I got an error:
SQLSTATE[HY000] [2002] No such file or directory
How to specify database name, password of production database?
How to do Laravel3 migration via SSH access in production server. I have used pagodabox it was working fine but very costly, so I switched to fortrabbit.com.
I tried this http://forums.laravel.io/viewtopic.php?id=6177, but no solution.
We surely will need more info about your problem.
To do a migration on Laravel using ssh, you basically have to go to your app folder and execute php artisan migrate. But I think you know that, right?
To specify your database infor for production,
1.create a ditectory production inside your app/config
2.copy your current app/config/database.php to it
3.edit your new app/config/production/database.php
4.on your app/start/global.php, configure your environment:
$env = $app->detectEnvironment(array(
'development' => array('localhost'),
'production' => array('example.com')
));
But to clarify it even better, you can watch this fresh video from Jeffrey Way on Laracasts:
https://laracasts.com/lessons/from-zero-to-deploy-with-fortrabbit

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