Search code examples
phpmysqllaravellaravel-artisanartisan-migrate

Git Cloned Laravel Project failing at php artisan migrate and php artisan db:seed


I git cloned a repository for a project written in Laravel/PHP. I was able to get most things running locally and I was able to create the initial migrations folder but I'm stuck at the seeding and table creation point (?). I keep get the following errors:

In Connection.php line 664:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lara_dev.users' doesn't exist (SQL: alter table `users` add `avatar` varchar(255   
  ) null default 'users/default.png' after `email`, add `role_id` int null after `id`)


In PDOStatement.php line 144:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lara_dev.users' doesn't exist  


In PDOStatement.php line 142:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lara_dev.users' doesn't exist  

*lara_dev is the local database's name. I created it directly in my MySQL local client terminal after git cloning the project, it was NOT created by any commands executed in the terminal.

Also:

The database folder has three folders inside: factories, migrations, and seeds. From what I see and understand, the files inside are configured correctly and the database should be created without issues and without having to edit these files.

I do NOT have a WAMP server, I'm simply using php's built in server through the command 'php artisan serve'.

Solutions I've tried so far that haven't worked:

  1. php artisan cache:clear //Clears the cache but that's about it.

  2. php artisan migrate:fresh --seed //Same errors but also drops any tables that were there before.

  3. php artisan migrate:refresh --seed // Gives 'nothing to rollback' message.

  4. php artisan db:seed //Same errors

I haven't been able to find any solutions here on Stack that work for my situation. Any help would be greatly appreciated.

Please take into account I am relatively new to PHP, but not to coding, and I've been able to get things running for the most part, I'm just stuck here. If I can provide additional information, please let me know. Thanks in advance!


Solution

  • Daniyal Javani gave me the right answer in the comments above. I added that exact file, https://github.com/laravel/laravel/blob/master/database/migrations/2014_10_12_000000_create_users_table.php, to my migrations folder. It created the users table I was missing and then running 'php artisan migrate' worked.