Attempted Debugging
Searched GitHub Issues
Describe the Scenario
When upgrading from 25.7.3 to 25.12.8 follow error occurs:
wait-for-db: waiting for bookstack-db-stg.bookstack-stg.svc.cluster.local:3306
wait-for-db: done
Starting Migration...
INFO Running migrations.
2025_09_15_134751_update_entity_relation_columns ............... 5.35ms FAIL
In Connection.php line 838:
SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN
KEY `bookshelves_books_book_id_foreign`; check that it exists (Connection:
mysql, Host: bookstack-db-stg.bookstack-stg.svc.cluster.local, Port: 3306,
Database: app, SQL: alter table `bookshelves_books` drop foreign key `books
helves_books_book_id_foreign`)
In Connection.php line 584:
SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN
KEY `bookshelves_books_book_id_foreign`; check that it exists
A downgrade to 25.7.3 to is possible. But I'm not sure how to fix these errors to be able to upgrade to 25.12.8
I could partly fix it thanks to #6046
Altered bookshelves_books.book_id bigint into int
Altered bookshelves_books.bookshelf_id bigint into int
Add constraint between bookshelves_books.book_id and books.id
Add constraint between bookshelves_books.bookshelf_id and bookshelves.id
Which is in code
-- Change column types
ALTER TABLE bookshelves_books
MODIFY book_id INT UNSIGNED;
ALTER TABLE bookshelves_books
MODIFY bookshelf_id INT UNSIGNED;
-- Add foreign key constraints
ALTER TABLE bookshelves_books
ADD CONSTRAINT bookshelves_books_book_id_foreign
FOREIGN KEY (book_id) REFERENCES books(id)
ON DELETE CASCADE;
ALTER TABLE bookshelves_books
ADD CONSTRAINT bookshelves_books_bookshelf_id_foreign
FOREIGN KEY (bookshelf_id) REFERENCES bookshelves(id)
ON DELETE CASCADE;
It fixed that the migration was running successful and bookstack is again accessible. But when accessing / editing of pages I see only older version. A workaround is to get into the Bookstack page revision and restore the newest version.
The Page revisions:
Kindly asking if somehow knows a solution for it. I'm trying digging here and if I find a solution I will post it here.
Exact BookStack Version
25.7.3
Log Content
Hosting Environment
Ubuntu 24.04 with rke2 1.33.5
Attempted Debugging
Searched GitHub Issues
Describe the Scenario
When upgrading from 25.7.3 to 25.12.8 follow error occurs:
A downgrade to 25.7.3 to is possible. But I'm not sure how to fix these errors to be able to upgrade to 25.12.8
I could partly fix it thanks to #6046
Which is in code
It fixed that the migration was running successful and bookstack is again accessible. But when accessing / editing of pages I see only older version. A workaround is to get into the Bookstack page revision and restore the newest version.
The Page revisions:
Kindly asking if somehow knows a solution for it. I'm trying digging here and if I find a solution I will post it here.
Exact BookStack Version
25.7.3
Log Content
Hosting Environment
Ubuntu 24.04 with rke2 1.33.5