I'm trying to learn the Laravel 5.1 framework, which is amazing. I'm following the tutorials of Jeffrey Way on laracasts.com. Only now i have come across a problem that i can't seem to get rid of.
I was following the tutorial and i tried to do a migrate:refresh with the php artisan, which should work, but i get this error all the time:
Error
And for the love of god, i can't figure out what the problem is. This is how my migration looks like:
Migration
I can't seem to find the answer anywhere. Any help would be greatly appreciated!
I think that the error is from one of your other migration files.
The migrate:refresh command will first roll back ALL of your database
migrations, and then run the migrate command.
http://laravel.com/docs/5.1/migrations
Related
Hello everyone,
This is my first time posting !
I am running into a problem when applying laravel 8 migrations on my new web server.
While trying to deploy my projet I'm unable to apply migrations and I'm not sure why.
Below images of the error and my migration, i'm using the php artisan migrate --seed command
Outputed message when migrating:
My migration with foreign keys:
The problem seems to be associated with the foreign key constraints but it's maybe because of something else. My server is running MySQL on InnoDB so I'm suspecting a compatibility problem, still, I have no clue how to solve it.
I tried:
Applying migrations one by one so that constraints would reference already existing foreign keys. Didn't work
Changing my engine to InnoDB in config/database.php. Didn't work
Importing my database manually using command line. Didn't work
Adding DB_ENGINE = InnoDB to the .env file. Didn't work
Switching from $table->foreign('idUser')->references('id')->on('users');
to $table->foreignId('idUser')->nullable->constrained();
My server
Centos 7
MySQL - InnoDB
PHP 7.4
Has Cpanel
Also, I have no problem applying the migrations on localhost, whitch leads me to believe this is not a problem with the structure of the migrations...
I am running out of ideas and can't seem to find a good awnser on the internet. Can someone help me ? Also please let me know if i forgot to provide important information
The problem was in fact with the way I wrote my migrations, if someone else has this problem, you can find a good awnser here: laravel-8-foreign-key
Thank you #brombeer for helping me !
I want to migrate table in Laravel Framework.
But when I migrate the table the following bug appears.
artisan migrate
I have tried all solutions in stackoverflow, but anything doesn't work.
In .env file, I have set all the values correctly. I checked that many times.
I also checked php version and composer version.
And added "psr-0" to composer.json and tried composer dump-autoload.
I did all ways which I can do.
If anyone have met this bug before, then Please tell me.
I'm trying to set up database migrations using Illuminate's Database outside of a Laravel 4.2 project. Everything I'm reading online indicated that it is completely doable to use any Illuminate components outside of Laravel, but the difficulty I'm having is creating the database migrations without using Artisan commands ("php artisan make:migration create_user_table"). If any one could help me out with this, I'd really appreciate it, because I know someone has had to find a solution to the problem before.
Thanks!
If you want to use artisan commands you should include the package of it and configure your application accordingly.
illuminate\database package doesn't provide you and artisan commands to use.
I'm trying to upgrade from 4.2 to 5 (and then actually upgraded to 5.1) but I'm having major problems with sentry
I followed instructions to add sentry to L5 here:
How can I use sentry with laravel 5?
With no luck.
Where I'm basically stuck is I got this on my controller:
$user = User::find(Sentry::getUser()->id);
When I try to view the page I get:
Trying to get property of non-object
So it seems it's simply not working.
I've tried multiple ways to get it to work, another one being:
https://cartalyst.com/manual/sentry/2.1#migrations
migration:
php artisan migrate --package=cartalyst/sentry
doesn't work with it though, as I understand this was removed. I really don't know could that help me with any way? Not very knowledgeable with this :)
Original app is not coded by me so I have not integrated the sentry in first place so I might be missing something obvious.
I'm trying to recover a project after a failed HDD. Lost the mysql information, so just have the project code.
I hoped to be able to put my database back together by using artisan migrate, but the error message tells me:
database.migrations doesn't exist
Is there actually a way I can use my Laravel code files and the command line to rebuilt my database like this?
Thanks for the help.
The command I needed to run was:
php artisan migrate:install
(I actually had more problems than this because the mysql install was messed up to. I don't know if simply php artisan migrate on its own would have implied :install but I'm adding it as an answer anyway should anyone have similar issues)