Laravel migrations table not found - php

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)

Related

Laravel 5.4 - "php artisan migrate" shows nothing

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.

Laravel app won't update database connection settings

I have a Laravel app, been using a specific set of database settings for a very long time, now I uploaded the whole application to CPanel and trying to change both the .env and .env.example files but still, when I look at the error logs uses the old database details, am stuck. Thanks in advance.
After cracking and scratching my head several times, I actually used these laravel CLI commands
php artisan config:clear
php artisan cache:clear
Now everything is working okay. Of course I took it offline first and used htdocs until it worked okay then uploaded the latest files.
I'm not sure if you are using the latest laravel framework 5.4 but you can try the following:
Clearing the config cache with this artisan command
php artisan config:clear
Checking the environment
php artisan env
With this command you can make sure that you are running under the correct environment. If you are using specific .env file such as ".env.local" or ".env.dev" etc.
Make sure there's nothing wrong with your dbms installation and try to connect to another blank db.
Hope this helps you!

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.

Laravel 4 Artisan not working at all

Just playing with Laravel 4 for the first time after using version 3 for a few projects but can't seem to get Artisan to work at all. I've done a bunch of searching and followed the troubleshooting steps I could find but no luck.
I've got Mcrypt installed
I had no bootstrap/compiled.php file to delete
I have the latest version of the framework from Github
I am on the latest version of Composer
When I try "composer update" I get this error:
Script php artisan optimize handling the post-update-cmd event returned with an error:
...with no extra information.
Trying to run "php artisan list" or any other artisan command just gives me no output at all.
Any ideas?
To summarise the discussion in the comments, we discovered that adding logging at the php.ini level revealed a PHP error that was not reported by the Composer console interface. I wonder whether you had installed Composer as root, and so some critical files required by Laravel were effectively invisible for a non-privileged user.
After running phpinfo, I noticed "--disable-mbregex" was part of the PHP configuration, meaning PHP was not compiled with the mbregex extension. My error logs were showing "Call to undefined function mb_regex_encoding".
Once PHP was recompiled with mb_regex_encoding, the issue went away.
If you are missing the /bootstrap/start.php file, you don't get helpful error messages from artisan and composer responds the same way. I went around and around trying solutions I found online and ultimately discovered this file was missing. I was back online as soon as I replaced it. I discovered this file was missing in my PHP error logs and artisan wasn't generating logs since it was unable to run.
I had a similar problem. Even the command $ php artisan --verson would not produce any output. Turned out, I had some code under app/start/global.php which was breaking under the CLI execution (but not breaking on the web side).
So that's another place to check for stuff! (app/start/global.php)
I was getting this problem, and it was because the subdirectories of storage did not yet exist.
Of course, these directories are created by the project-creating script, but they're quite easy to leave out of source control and so will be missing on a freshly cloned project. The .gitignore files are in there for a reason it would seem!
This problem occurred for me when there were files in the storage folder that were not writable for the current user. php artisan silently failed, without output. Changing permissions helped.

Categories