Home > Back-end >  Laravel Migrating a migration I didn't make
Laravel Migrating a migration I didn't make

Time:04-20

I made 4 migrations and I'm trying to migrate them with php artisan migrate:fresh. However, I'm getting an error

Migrating: 2019_12_14_000001_create_personal_access_tokens_table

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `personal_access_tokens` add index `personal_access_tokens_tokenable_type_tokenable_id_index`(`tokenable_type`, `tokenable_id`))

  at C:\Users\Victor\Desktop\Oefenexamen\oefenexamen\vendor\laravel\framework\src\Illuminate\Database\Connection.php:745
    741▕         // If an exception occurs when attempting to run a query, we'll format the error
    742▕         // message to include the bindings with SQL, which will make this exception a
    743▕         // lot more helpful to the developer instead of just the database's errors.
    744▕         catch (Exception $e) {
  ➜ 745▕             throw new QueryException(
    746▕                 $query, $this->prepareBindings($bindings), $e
    747▕             );
    748▕         }
    749▕     }

  1   C:\Users\Victor\Desktop\Oefenexamen\oefenexamen\vendor\laravel\framework\src\Illuminate\Database\Connection.php:530
      PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")

  2   C:\Users\Victor\Desktop\Oefenexamen\oefenexamen\vendor\laravel\framework\src\Illuminate\Database\Connection.php:530
      PDOStatement::execute()

However, I don't have the 2019_12_14_000001_create_personal_access_tokens_table migration, why is it being ran?

CodePudding user response:

Manually delete the migration file

2019_12_14_000001_create_personal_access_tokens_table

Reset the composer autoload files: composer dump-autoload

after that run: php artisan migrate:fresh

  • Related