linuxserver / docker-bookstack

A Docker container for the BookStack documentation wiki
GNU General Public License v3.0
762 stars 108 forks source link

SQL error Column already exists: 1060 Duplicate column name 'slug' when performing upgrade #92

Closed wouterVE closed 3 years ago

wouterVE commented 3 years ago

When performing upgrade via command docker-compose down && docker-compose up -d I receive the following SQL error in the bookstack container:

-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing... 
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing... 
App Key found - setting variable for seds
Running config - db_user set
/var/run/s6/etc/cont-init.d/50-config: line 86: warning: command substitution: ignored null byte in input
/var/run/s6/etc/cont-init.d/50-config: line 86: warning: command substitution: ignored null byte in input
Migrating: 2021_03_08_215138_add_user_slug

   Illuminate\Database\QueryException  : SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'slug' (SQL: alter table `users` add `slug` varchar(180) not null)

  at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDO\Exception::("SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'slug'")
      /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18

  2   Doctrine\DBAL\Driver\PDO\Exception::new(Object(PDOException))
      /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:114

  Please use the argument -v to see more details.

All seems to be working well tough.

Here is my environment:

SBC Odroid XU4 Armbian 21.02.3 with Linux kernel Linux 4.14.222-odroidxu4

Here is my docker-compose.yml


---
version: "2"
services:
  bookstack:
    image: linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=https://bookstackurl
      - DB_HOST=bookstack_db
      - DB_USER=<db-user>
      - DB_PASS=<db-pw>
      - DB_DATABASE=<<db-user-pwd>
    volumes:
      - /path/to/config:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=<mysql root pw>
      - TZ=Europe/Brussels
      - MYSQL_DATABASE=<db-bookstack>
      - MYSQL_USER=<db-user>
      - MYSQL_PASSWORD=<db-user-pwd>
    volumes:
      - /path/to/config:/config
      - /path/to/sqlback/:/home
 restart: unless-stopped
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

Roxedus commented 3 years ago

Are you on a up-to-date version of the image? ref BookStackApp/BookStack#2710

wouterVE commented 3 years ago

Thanks for your link, I deleted the column slug from my database (as suggested here) & no errors after updating now:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \ 
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing... 
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing... 
App Key found - setting variable for seds
Running config - db_user set
/var/run/s6/etc/cont-init.d/50-config: line 86: warning: command substitution: ignored null byte in input
/var/run/s6/etc/cont-init.d/50-config: line 86: warning: command substitution: ignored null byte in input
Migrating: 2021_03_08_215138_add_user_slug
Migrated:  2021_03_08_215138_add_user_slug (0.46 seconds)
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.