-2

I'm trying to make a migration for a new table for my scheme and when I run php artisan migrate I get the following mistake:

Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException  : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(191) not null, `email` varchar(191) not null, `email_verified_at` timestamp null, `password` varchar(191) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

I did not create that migration, it came automatically with the php artisan make:auth and as far as I know it has already run because the users table is up and running, so I've no idea how to get around it. Any help would be greatly appreciated

Zoe Edwards
  • 12,999
  • 3
  • 24
  • 43
M0llzilla
  • 33
  • 5
  • Depends how far you are with project/database. If u didnt fill your tables with important data, you can just drop them all and migrate everything again (simpliest solution). When you want migrate only specific table you can create subfolder in mogrations for specific tables (you can choose which ones will be migrated) – Skeldar Sep 02 '19 at 15:28
  • The table I' trying to create is called player_player so it thas nothing to do with a users table – M0llzilla Sep 02 '19 at 15:29
  • When you call migrate all schema from database/migrations directory are beeing executed. Maybe this is solution: https://stackoverflow.com/questions/45473624/laravel-5-4-specific-table-migration – Skeldar Sep 02 '19 at 15:31
  • Try `php artisan migrate:refresh` – Salim Djerbouh Sep 02 '19 at 15:45

1 Answers1

0

try running php artisan migrate:reset if it didnt work and gave u an error login to your phpmyadmin page and delete it manually.

but before running php artisan migrate again make sure that this code in the bottom of create_users_table migration file:

 @return void

public function down()
{
    Schema::dropIfExists('users');
}

so when u run php artisan migrate:refresh it drop the current table and re-create it

Remon Tadros
  • 33
  • 1
  • 6