Error during migration for user_slug when upgrading to v21.04 #2191

Closed
opened 2026-02-05 03:16:29 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @mflagler on GitHub (Apr 12, 2021).

Describe the bug
When trying to upgrade BookStack from v0.30.2 to v21.04 on PHP 7.4 and using LDAP authentication I am getting the following error during the migration process for 2021_03_08_215138_add_user_slug:

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table 'users' add unique 'users_slug_unique'('slug'))

Steps To Reproduce
Steps to reproduce the behavior:

  1. Execute git pull origin release && composer install --no-dev && php artisan migrate from the bookstack installation path
  2. Git pull and composer install process without any issues
  3. Most of the migration works fine
  4. Migrating: 2021_03_08_215138_add_user_slug produces the error

Expected behavior
Migration step should complete without errors and complete the upgrade

Screenshots
If applicable, add screenshots to help explain your problem.
image

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v0.30.2
  • PHP Version: 7.4
  • Hosting Method (Nginx/Apache/Docker): Apache

Additional context
Digging into it, it looks like it could be caused by me running MariaDB and the specific version, but the mitigations described everywhere I look about setting a default string length are already in the BookStack source, so not sure why it's not working.

Originally created by @mflagler on GitHub (Apr 12, 2021). **Describe the bug** When trying to upgrade BookStack from v0.30.2 to v21.04 on PHP 7.4 and using LDAP authentication I am getting the following error during the migration process for 2021_03_08_215138_add_user_slug: >Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table 'users' add unique 'users_slug_unique'('slug')) **Steps To Reproduce** Steps to reproduce the behavior: 1. Execute `git pull origin release && composer install --no-dev && php artisan migrate` from the bookstack installation path 2. Git pull and composer install process without any issues 3. Most of the migration works fine 4. `Migrating: 2021_03_08_215138_add_user_slug` produces the error **Expected behavior** Migration step should complete without errors and complete the upgrade **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/17576920/114422473-ecbca200-9b7b-11eb-8efb-2e415c07bc06.png) **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v0.30.2 - PHP Version: 7.4 - Hosting Method (Nginx/Apache/Docker): Apache **Additional context** Digging into it, it looks like it could be caused by me running MariaDB and the specific version, but the mitigations described everywhere I look about setting a default string length are already in the BookStack source, so not sure why it's not working.
Author
Owner

@mflagler commented on GitHub (Apr 12, 2021):

So since I was on Ubuntu v18 I went ahead and updated to Ubuntu v20 which upgraded MariaDB from 10.1 to 10.3 and the upgrade works fine now. If you want to stick with Ubuntu v18 and are using MariaDB v10.1 you'll need to update MariaDB to 10.3 to fix this issue most likely.

@mflagler commented on GitHub (Apr 12, 2021): So since I was on Ubuntu v18 I went ahead and updated to Ubuntu v20 which upgraded MariaDB from 10.1 to 10.3 and the upgrade works fine now. If you want to stick with Ubuntu v18 and are using MariaDB v10.1 you'll need to update MariaDB to 10.3 to fix this issue most likely.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2191