Laravel 5.4 - "php artisan migrate" shows nothing - php

I just got started with Laravel and I connected my application to my mysql database. I created an additional migration file, but when I run the php artisan migrate, nothing happens. I tried waiting for even 10 minutes but absolutely nothing. When I connect to the mysql service and select the database to show tables there are 0 results. Something is happening and it just doesn't want to migrate. Thanks for helping.
EDIT:
I forgot to mention that any migrate command does not work.
Example: php artisan migrate, php artisan migrate:rollback, php artisan migrate:status.
It just sits there with no output until I end it manually.
SOLUTION: So it seems like the problem was that the user I was trying to connect with didn't have the proper privileges. For some reason, mysql was kind enough not to give me any feedback and letting me figure it out.

Related

php artisan migrate saying "nothing to migrate"

I've just got my MySQL database setup. When I run php artisan migrate, it creates the migrations table (which is empty) and then says "nothing to migrate". I have 3 migration files. I've tried php artisan migrate:reset, php artisan migrate:refresh and php artisan config:cache, but it still says the same thing. I've tried making a new database but the same comes from that. The empty migrations table is the only table in the database. Please help me fix this, thanks!
If you are altering a table, make sure you delete the information from the migrate table in your DB. I solved a similar problem by deleting the information from the migrate table in my DB.

laravel 5.4 migration issue

I am having a very weird issue when running
php artisan migrate
on a new installation of Laravel 5.4 on a local XAMPP server with php 7.1.1.
What it is doing is creating a migrations and users table, the default tables in older versions of Laravel. What is should be creating is a users table and a passwords reset table, the new default tables. My env file is correct because I am connecting to the database correctly but then if I change the table I am connecting to in the env file it is not updating.
To me, it seems like the command is simply not running on the correct migrations folder in the application. This is a brand new machine with a fresh install of XAMPP and Laravel so I am very confused as to why this is happening. Any help would be much appreciated!!!
I was finally able to get this to work so I wanted to answer the question to explain what I did.
This first step may not be required for you but it was for me. Once again, here is what I was using: Laravel 5.4 on a local XAMPP server with php 7.1.1
-First I needed to edit app>Providers>AppServiceProvider.php https://laravel-news.com/laravel-5-4-key-too-long-error
-Add this line to the top, under the other use include: use Illuminate\Support\Facades\Schema;
-In the boot() function add this code: Schema::defaultStringLength(191);
-After that I needed to run php artisan migrate, to create the default tables from the migrations. For some reason, a reason I could not find with any amount of research, this creates the old tables from an unknown source. After that I needed to edit the create_users_table migration, delete the users and migrations table that were created in the database, then rerun php artisan migrate. Like I said, I am not sure why this has to be done but it will get it to work.
Also, remember to run these commands before running php artisan migrate the last time just to be safe:
php artisan cache:clear
php artisan config:cache
php artisan migrate:refresh
php artisan migrate

php artisan up command not working in laravel?

I have this very strange problem in laravel. I successfully put my website into maintenance mode via artisan by this command:
php artisan down
But now i have to put my website back into live mode.I tried:
php artisan up
However, the site isn't going live even though i get success message? Have you guys ever faced this issue?
Whats the fix?
I'm on :
1. Macbook pro Mamp
2. Laravel 5.1
Thanks
artisan up command simply deletes storage/framework/down file. Please check if the file exits after you execute the up command. If it still exists, it seems like a file access issue. Whenever you run down/up commands, make sure that you run them as the same user that is running your application.
In order to get the site up and running again, remove the storage/framework/down file manually.

How to keep your old migration as reference?

I have 38 migration script that I wrote in Laravel 4.
I don't want to throw them away, but I also don't want to run them either. I just want to keep them as references.
If I place them in the migration folder in Laravel, it will run when I do
php artisan migrate and that will break some part of my database, as they have already been run.
I'm wondering if there is a way to mark them as already run, so Laravel will not trying to run them again.
I notice the migration table in my database - can I do something with it ?
What is the best way I should do to those 38 migrations ? Feel free to give me any suggestions.
Your question is a little confusing -- Laravel will only run each migration once. It keeps track of which migrations have run in the migrations table. The whole idea of migrations is a series of date sortable scripts that you can run at anytime start to finish and they rebuild your database, AND that you can add to without needing to rerun them all as they work (so your data is preserved)
If you're running
php artisan migrate
and Laravel's running a migration it has already run, something is very broken with your system.
(Speculation follows) It seems more likely the latest migration you're running may have halted half way though in a place MySQL couldn't rollback the changes, and Laravel's trying to rerun the latest one. Try a
php artisan migrate:rollback
Fix the error in the breaking migration, and you'll be all set.

Laravel migrations table not found

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)

Categories