Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] - database error on install defaultStringLength #37

Open
Nejcc opened this issue Feb 28, 2024 · 1 comment
Open

[bug] - database error on install defaultStringLength #37

Nejcc opened this issue Feb 28, 2024 · 1 comment

Comments

@Nejcc
Copy link

Nejcc commented Feb 28, 2024

 Would you like to create it? (yes/no) [no]
❯ yes

   INFO  Preparing database.  

  Creating migration table ............................................................................................................... 39ms DONE

   INFO  Running migrations.  

  2019_12_14_000001_create_personal_access_tokens_table .................................................................................. 10ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `fs_personal_access_tokens` add index `fs_personal_access_tokens_tokenable_type_tokenable_id_index`(`tokenable
_type`, `tokenable_id`))

  at vendor\laravel\framework\src\Illuminate\Database\Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
    828▕
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

Where can i put Schema::defaultStringLength(191); AppServiceProvider not found ?

I fix the issue by adding php artisan make:provider DatabaseServiceProvider

App\Providers\DatabaseServiceProvider::class, in config app.php

and add in boot method -> Schema::defaultStringLength(191);

@jevantang
Copy link
Member

This is a migration feature of the Laravel framework, not a Fresns issue.

May I ask what database you have and the version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants