Skip to content

Instantly share code, notes, and snippets.

@nicosomb
Last active August 30, 2019 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nicosomb/7c537995f2b845a30b4d6cdf23c1e22c to your computer and use it in GitHub Desktop.
Save nicosomb/7c537995f2b845a30b4d6cdf23c1e22c to your computer and use it in GitHub Desktop.
Fix for wallabag 2.2 and SQLite

After upgrading wallabag to 2.2, if you use SQLite for database, you may have a blank page or an internal server error (error 500). It can be due to migrations which failed.

The migrations who failed are migrations which try to create new columns on tables.

To fix this problem, please execute these commands on your webserver:

    php bin/console doctrine:migration:execute 20161024212538 -e=prod
    php bin/console doctrine:migration:execute 20161106113822 -e=prod
    php bin/console doctrine:migration:execute 20161118134328 -e=prod
    php bin/console doctrine:migration:execute 20161128084725 -e=prod
    php bin/console doctrine:migration:execute 20161214094402 -e=prod

If for some commands, you have this error:

    ++ migrating 20161118134328
    -> ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL
    Migration 20161118134328 failed during Post-Checks. Error An exception occurred while executing 'INSERT INTO migration_versions (version) VALUES (?)' with params ["20161118134328"]:
    SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: migration_versions.version

Please open your database like this (or with a tool like DB Browser for SQLite)

    sqlite3 data/db/wallabag.sqlite

Then, execute the query corresponding to the migration which failed:

delete from migration_versions where version = "20161024212538";
delete from migration_versions where version = "20161106113822";
delete from migration_versions where version = "20161118134328";
delete from migration_versions where version = "20161128084725";
delete from migration_versions where version = "20161214094402";

Then, re-execute the command which failed.

@irgendwie
Copy link

Did work for me, thanks! 👍

@ZEROF
Copy link

ZEROF commented May 15, 2017

Hi,

I will just add fix fox docker/sqlite users.

On host running docker find db/wallabag.sqlite and run

 sudo sqlite3 wallabag.sqlite

and run

delete from migration_versions where version = "20161024212538";
delete from migration_versions where version = "20161106113822";
delete from migration_versions where version = "20161118134328";
delete from migration_versions where version = "20161128084725";
delete from migration_versions where version = "20161214094402";

Then sh to wallabag container:

docker exec -it wallabag sh

Then

php /var/www/wallabag/bin/console doctrine:migration:execute  20161024212538 -e=prod
php /var/www/wallabag/bin/console doctrine:migration:execute  20161106113822 -e=prod
php /var/www/wallabag/bin/console doctrine:migration:execute  20161118134328 -e=prod
php /var/www/wallabag/bin/console doctrine:migration:execute  20161128084725 -e=prod
php /var/www/wallabag/bin/console doctrine:migration:execute  20161214094402 -e=prod

And your are done :)

@DmitrySandalov
Copy link

$ docker-compose exec wallabag sh
# find /var/www/wallabag/app/DoctrineMigrations/ | sort | grep Version | sed 's/.*Version//; s/.php//' | xargs -I {} php /var/www/wallabag/bin/console --no-interaction doctrine:migration:execute {}  -e=prod

$ sudo sqlite3 wallabag.sqlite
sqlite> delete from migration_versions;

$ docker-compose exec poche sh
# find /var/www/wallabag/app/DoctrineMigrations/ | sort | grep Version | sed 's/.*Version//; s/.php//' | xargs -I {} php /var/www/wallabag/bin/console --no-interaction doctrine:migration:execute {}  -e=prod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment