Upgrade issues #3298

Closed
opened 2026-02-05 06:17:27 +03:00 by OVERLORD · 13 comments
Owner

Originally created by @rajengg23 on GitHub (Oct 24, 2022).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I have tried to upgrade recent release 22.10 and i got issues as below

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists (SQL: create table references (id bigint unsigned not null auto_increment primary key, from_id int unsigned not null, from_type varchar(25) not null, to_id int unsigned not null, to_type varchar(25) not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }

  +9 vendor frames

10 database/migrations/2022_08_17_092941_create_references_table.php:22
Illuminate\Support\Facades\Facade::__callStatic()

  +22 vendor frames

33 artisan:37
Illuminate\Foundation\Console\Kernel::handle()

Exact BookStack Version

22.10

Log Content

No response

PHP Version

8.X

Hosting Environment

20.04

Originally created by @rajengg23 on GitHub (Oct 24, 2022). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I have tried to upgrade recent release 22.10 and i got issues as below SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists (SQL: create table `references` (`id` bigint unsigned not null auto_increment primary key, `from_id` int unsigned not null, `from_type` varchar(25) not null, `to_id` int unsigned not null, `to_type` varchar(25) not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712 708▕ // If an exception occurs when attempting to run a query, we'll format the error 709▕ // message to include the bindings with SQL, which will make this exception a 710▕ // lot more helpful to the developer instead of just the database's errors. 711▕ catch (Exception $e) { ➜ 712▕ throw new QueryException( 713▕ $query, $this->prepareBindings($bindings), $e 714▕ ); 715▕ } 716▕ } +9 vendor frames 10 database/migrations/2022_08_17_092941_create_references_table.php:22 Illuminate\Support\Facades\Facade::__callStatic() +22 vendor frames 33 artisan:37 Illuminate\Foundation\Console\Kernel::handle() ### Exact BookStack Version 22.10 ### Log Content _No response_ ### PHP Version 8.X ### Hosting Environment 20.04
OVERLORD added the 🐕 Support label 2026-02-05 06:17:27 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Oct 24, 2022):

Hi @rajengg23,
This indicates there may have been unaddressed issues upon a previous upgrade.
Before anything, ensure your system/data is backed-up.

Are you familiar with performing operations on the database?
If so, please try dropping the references table in your BookStack database, then re-run the php artisan migrate step, noting any errors that appear on first run of that command.

If you need guidance for make those database changes, let me know but I'd ideally need to know a little extra about your environment, such as is that Ubuntu? And did you originally use our install script?

@ssddanbrown commented on GitHub (Oct 24, 2022): Hi @rajengg23, This indicates there may have been unaddressed issues upon a previous upgrade. Before anything, ensure your system/data is backed-up. Are you familiar with performing operations on the database? If so, please try dropping the `references` table in your BookStack database, then re-run the `php artisan migrate` step, noting any errors that appear on first run of that command. If you need guidance for make those database changes, let me know but I'd ideally need to know a little extra about your environment, such as is that Ubuntu? And did you originally use our install script?
Author
Owner

@geoigeek commented on GitHub (Oct 24, 2022):

Hello,

I also have problems after the update to 22.10 (it's the first update for this installation). I can log in to bookstack with 2FA and then see only a blank page.
In the Apache Error Log I find the following:

n#49 {main}\n\nNext Illuminate\\Database\\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'view' in 'where clause' (SQL: select count(*) as aggregate from `entity_permissions` where `view` = 1 and `role_id` in (1) and `entity_type` = bookshelf) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\\Database\\Connection->runQueryCallback()\n#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\\Database\\Connection->run()\n#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\\Database\\Connection->select()\n#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\\Database\\Query\\Builder->runSelect()\n#4 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(293

Apache Access Log

192.168.248.12 - - [24/Oct/2022:19:17:13 +0000] "GET / HTTP/1.1" 500 185 "https://wiki.xxx.tld/mfa/verify" "Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0"```

**Host** Ubuntu 22.04
**Bookstack  Update** from 22.09 to 22.10
@geoigeek commented on GitHub (Oct 24, 2022): Hello, I also have problems after the update to 22.10 (it's the first update for this installation). I can log in to bookstack with 2FA and then see only a blank page. **In the Apache Error Log I find the following:** ``` n#49 {main}\n\nNext Illuminate\\Database\\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'view' in 'where clause' (SQL: select count(*) as aggregate from `entity_permissions` where `view` = 1 and `role_id` in (1) and `entity_type` = bookshelf) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\\Database\\Connection->runQueryCallback()\n#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\\Database\\Connection->run()\n#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\\Database\\Connection->select()\n#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\\Database\\Query\\Builder->runSelect()\n#4 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(293 ``` **Apache Access Log** ```[24/Oct/2022:19:17:13 +0000] "POST /mfa/totp/verify HTTP/1.1" 302 1874 "https://wiki.xxx.tld/mfa/verify" "Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0" 192.168.248.12 - - [24/Oct/2022:19:17:13 +0000] "GET / HTTP/1.1" 500 185 "https://wiki.xxx.tld/mfa/verify" "Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0"``` **Host** Ubuntu 22.04 **Bookstack Update** from 22.09 to 22.10
Author
Owner

@ssddanbrown commented on GitHub (Oct 25, 2022):

@geoigeek Your database does not look up-to-date. Please open a new issue so you can detail your specific environment and issue, and include the output of running the php artisan migrate update step.

@ssddanbrown commented on GitHub (Oct 25, 2022): @geoigeek Your database does not look up-to-date. Please open a new issue so you can detail your specific environment and issue, and include the output of running the `php artisan migrate` update step.
Author
Owner

@rajengg23 commented on GitHub (Oct 25, 2022):

Yes, I did but when I run php migrate it’s giving same error.

@rajengg23 commented on GitHub (Oct 25, 2022): Yes, I did but when I run php migrate it’s giving same error.
Author
Owner

@ssddanbrown commented on GitHub (Oct 25, 2022):

@rajengg23 That last message was targeted for a different user.

If you were responding to my previous comment, Please confirm exactly how you're performing the requested step to drop the suggested table, and the exact command line output after first run of the migrate command after performing the table drop operation.

@ssddanbrown commented on GitHub (Oct 25, 2022): @rajengg23 That last message was targeted for a different user. If you were responding to my previous comment, Please confirm exactly how you're performing the requested step to drop the suggested table, and the exact command line output after _**first run**_ of the migrate command after performing the table drop operation.
Author
Owner

@rajengg23 commented on GitHub (Oct 25, 2022):

I tried drop table references; using MySQL

@rajengg23 commented on GitHub (Oct 25, 2022): I tried drop table references; using MySQL
Author
Owner

@rajengg23 commented on GitHub (Oct 25, 2022):

I got Error as below

In Connection.php line 712:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references'
already exists (SQL: create table references (id bigint unsigned not n
ull auto_increment primary key, from_id int unsigned not null, from_type varchar(25) not null, to_id int unsigned not null, to_type varchar(25
) not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

this is never happen i have change to fresh and then restore the database but remain on same issues

@rajengg23 commented on GitHub (Oct 25, 2022): I got Error as below In Connection.php line 712: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists (SQL: create table `references` (`id` bigint unsigned not n ull auto_increment primary key, `from_id` int unsigned not null, `from_type ` varchar(25) not null, `to_id` int unsigned not null, `to_type` varchar(25 ) not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci') this is never happen i have change to fresh and then restore the database but remain on same issues
Author
Owner

@ssddanbrown commented on GitHub (Oct 25, 2022):

this is never happen i have change to fresh and then restore the database but remain on same issues

If you are creating a fresh bookstack install, with migrated database, then restoring your old database into it, then I'd expect this error to occur. You should only restore into a fresh database with no existing tables.

If you are properly dropping the references table you should not see that reported error. Again, Please confirm exactly how you're performing the requested step to drop the suggested table and any steps you're performing to ensure the table has been dropped.

@ssddanbrown commented on GitHub (Oct 25, 2022): > this is never happen i have change to fresh and then restore the database but remain on same issues If you are creating a fresh bookstack install, with migrated database, then restoring your old database into it, then I'd expect this error to occur. You should only restore into a fresh database with no existing tables. If you are properly dropping the `references` table you should not see that reported error. Again, Please confirm exactly how you're performing the requested step to drop the suggested table and any steps you're performing to ensure the table has been dropped.
Author
Owner

@ssddanbrown commented on GitHub (Nov 4, 2022):

Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed respond to my previous comment and this can then be re-opened.

@ssddanbrown commented on GitHub (Nov 4, 2022): Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed respond to my previous comment and this can then be re-opened.
Author
Owner

@rajengg23 commented on GitHub (Nov 4, 2022):

Dan it’s not completed do you have steps to drop?

On Fri, Nov 4, 2022 at 5:41 AM Dan Brown @.***> wrote:

Closed #3800 https://github.com/BookStackApp/BookStack/issues/3800 as
completed.


Reply to this email directly, view it on GitHub
https://github.com/BookStackApp/BookStack/issues/3800#event-7739987729,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJAHM73NEANHJX6YTW6HUZTWGTZAFANCNFSM6AAAAAARMO6B5E
.
You are receiving this because you were mentioned.Message ID:
@.***>

--
Thanks & Regards
Jay Prakash Pandey
8147708281

@rajengg23 commented on GitHub (Nov 4, 2022): Dan it’s not completed do you have steps to drop? On Fri, Nov 4, 2022 at 5:41 AM Dan Brown ***@***.***> wrote: > Closed #3800 <https://github.com/BookStackApp/BookStack/issues/3800> as > completed. > > — > Reply to this email directly, view it on GitHub > <https://github.com/BookStackApp/BookStack/issues/3800#event-7739987729>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AJAHM73NEANHJX6YTW6HUZTWGTZAFANCNFSM6AAAAAARMO6B5E> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> > -- Thanks & Regards Jay Prakash Pandey 8147708281
Author
Owner

@ssddanbrown commented on GitHub (Nov 4, 2022):

Dan it’s not completed do you have steps to drop?

Backup the system/all-data first.

  1. Access MySQL, typically via sudo mysql -u root
  2. Select your database, typically use bookstack; assuming you're BookStack database is called bookstack within mysql.
  3. Drop the table via drop table references;.
  4. Exit mysql exit;
  5. Re-attempt migration, noting any errors shown on first php artisan migrate command run.
@ssddanbrown commented on GitHub (Nov 4, 2022): > Dan it’s not completed do you have steps to drop? Backup the system/all-data first. 1. Access MySQL, typically via `sudo mysql -u root` 2. Select your database, typically `use bookstack;` assuming you're BookStack database is called `bookstack` within mysql. 3. Drop the table via `drop table references;`. 4. Exit mysql `exit;` 5. Re-attempt migration, noting any errors shown on first `php artisan migrate` command run.
Author
Owner

@ssddanbrown commented on GitHub (Nov 12, 2022):

Since there's been no further follow-up I'm going to close this off.

@ssddanbrown commented on GitHub (Nov 12, 2022): Since there's been no further follow-up I'm going to close this off.
Author
Owner

@quentinDupont commented on GitHub (Nov 21, 2023):

For information, i had to add '' to make it work :)

image

@quentinDupont commented on GitHub (Nov 21, 2023): For information, i had to add '' to make it work :) ![image](https://github.com/BookStackApp/BookStack/assets/9005817/86de2dd1-3ab1-4fe4-8beb-37a8d411a4e2)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3298