bookstack-system-cli restore (buggy) #5200

Closed
opened 2026-02-05 09:47:57 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @samysilva on GitHub (Feb 28, 2025).

Describe the Bug

Version: Current
BookStack v25.02

`root@tb-docs1:~# /var/www/bookstack/bookstack-system-cli -vvv restore /var/www/bookstack/storage/backups/bookstack-backup-2025-02-27-213253.zip
WARNING: This CLI is in early alpha testing.
There's a high chance of running into bugs, and the CLI API is subject to change.

Warning!

  • A restore operation will overwrite and remove files & content from an existing instance.
  • Any existing tables within the configured database will be dropped.
  • You should only restore into an instance of the same or newer BookStack version.
  • This command won't handle, restore or address any server configuration.
    Checking system requirements...

Contents found in the backup ZIP:
✔ .env Config File
✔ Themes Folder
✔ Public File Uploads
✔ Private File Uploads
✔ Database Dump
The checked elements will be restored into [/var/www/bookstack].
Existing content will be overwritten.
Do you want to continue? (y/n)
y
Extracting ZIP into temporary directory...
Restoring and merging .env file...
Restoring themes folder...
Restoring public/uploads folder...
Restoring storage/uploads folder...
Restoring database from SQL dump...
Running database migrations...

An error occurred when attempting to run a command:

Failed 'php artisan migrate --force' with errors:

In Connection.php line 825:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sort_rules'
already exists (Connection: mysql, SQL: create table sort_rules (id in
t unsigned not null auto_increment primary key, name varchar(191) not nul
l, sequence text not null, created_at timestamp null, updated_at time
stamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

In Connection.php line 571:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sort_rules'
already exists `

Steps to Reproduce

bookstack-system-cli.txt

Expected Behaviour

/var/www/bookstack/bookstack-system-cli -vvv restore FILE.zip

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v25.02

Originally created by @samysilva on GitHub (Feb 28, 2025). ### Describe the Bug Version: Current BookStack v25.02 `root@tb-docs1:~# /var/www/bookstack/bookstack-system-cli -vvv **restore** /var/www/bookstack/storage/backups/bookstack-backup-2025-02-27-213253.zip WARNING: This CLI is in early alpha testing. There's a high chance of running into bugs, and the CLI API is subject to change. Warning! - A restore operation will overwrite and remove files & content from an existing instance. - Any existing tables within the configured database will be dropped. - You should only restore into an instance of the same or newer BookStack version. - This command won't handle, restore or address any server configuration. Checking system requirements... Contents found in the backup ZIP: ✔ .env Config File ✔ Themes Folder ✔ Public File Uploads ✔ Private File Uploads ✔ Database Dump The checked elements will be restored into [/var/www/bookstack]. Existing content will be overwritten. Do you want to continue? (y/n) y Extracting ZIP into temporary directory... Restoring and merging .env file... Restoring themes folder... Restoring public/uploads folder... Restoring storage/uploads folder... Restoring database from SQL dump... **Running database migrations...** An error occurred when attempting to run a command: Failed 'php artisan migrate --force' with errors: In Connection.php line 825: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sort_rules' already exists (Connection: mysql, SQL: create table `sort_rules` (`id` in t unsigned not null auto_increment primary key, `name` varchar(191) not nul l, `sequence` text not null, `created_at` timestamp null, `updated_at` time stamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci') In Connection.php line 571: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sort_rules' already exists ` ### Steps to Reproduce [bookstack-system-cli.txt](https://github.com/user-attachments/files/19016622/bookstack-system-cli.txt) ### Expected Behaviour /var/www/bookstack/bookstack-system-cli -vvv restore FILE.zip ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v25.02
OVERLORD added the 🐛 Bug label 2026-02-05 09:47:57 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Mar 1, 2025):

Hi @samysilva,

The CLI should attempt to empty the database before restoring which should avoid this issue.
Either that failed, or the database originally backed up could have been in a bad state.

Was an update attempted to v25.02 on the system which was originally backed up for this zip you're attempting to restore?

@ssddanbrown commented on GitHub (Mar 1, 2025): Hi @samysilva, The CLI should attempt to empty the database before restoring which should avoid this issue. Either that failed, or the database originally backed up could have been in a bad state. Was an update attempted to v25.02 on the system which was originally backed up for this zip you're attempting to restore?
Author
Owner

@ssddanbrown commented on GitHub (Mar 13, 2025):

Since there's been no further follow up I'll go ahead and close this off.

@ssddanbrown commented on GitHub (Mar 13, 2025): Since there's been no further follow up I'll go ahead and close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5200