New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database migrations issue during upgrade from 2.1.5 to 2.2.0 #2795

Closed
Aldarone opened this Issue Jan 28, 2017 · 23 comments

Comments

Projects
None yet
@Aldarone

Aldarone commented Jan 28, 2017

Issue details

Please provide issue details here.
Remember, this is not a place to ask questions. For that, go to http://gitter.im/wallabag/wallabag.

Environment

  • wallabag version (or git revision) that exhibits the issue: 2.2.0
  • How did you install wallabag? Using git clone
  • Last wallabag version that did not exhibit the issue (if applicable): 2.1.5
  • php version: PHP 5.6.26-1+deb.sury.org~trusty+1
  • OS: Ubuntu 14.04.5 LTS
  • type of hosting (shared or dedicated): Dedicated
  • which storage system you choose at install (SQLite, MySQL/MariaDB or PostgreSQL): SQLite

Steps to reproduce/test case

After upgrading from 2.1.5 to 2.2.0 using make update I can't log in anymore.

At first I was just sent back to the login page and I tried to reset my password, but there was this error :

An exception occurred while executing 'SELECT t0.username AS username_1, t0.username_canonical AS username_canonical_2, t0.email AS email_3, t0.email_canonical AS email_canonical_4, t0.enabled AS enabled_5, t0.salt AS salt_6, t0.password AS password_7, t0.last_login AS last_login_8, t0.confirmation_token AS confirmation_token_9, t0.password_requested_at AS password_requested_at_10, t0.roles AS roles_11, t0.id AS id_12, t0.name AS name_13, t0.created_at AS created_at_14, t0.updated_at AS updated_at_15, t0.authCode AS authCode_16, t0.twoFactorAuthentication AS twoFactorAuthentication_17, t0.trusted AS trusted_18, t19.id AS id_20, t19.theme AS theme_21, t19.items_per_page AS items_per_page_22, t19.language AS language_23, t19.rss_token AS rss_token_24, t19.rss_limit AS rss_limit_25, t19.reading_speed AS reading_speed_26, t19.pocket_consumer_key AS pocket_consumer_key_27, t19.action_mark_as_read AS action_mark_as_read_28, t19.list_mode AS list_mode_29, t19.user_id AS user_id_30 FROM "wallabag_user" t0 LEFT JOIN "wallabag_config" t19 ON t19.user_id = t0.id WHERE t0.email_canonical = ? LIMIT 1' with params ["redacted@fake.com"]: SQLSTATE[HY000]: General error: 1 no such column: t19.action_mark_as_read

Then, I ran make update again and some database migrations has been applied :

Migrating up to 20170127093841 from 20160916201049

  ++ migrating 20161001072726


  SS skipped (Reason: Migration can only be executed safely on 'mysql' or 'postgresql'.)

  ++ migrating 20161022134138


  SS skipped (Reason: This migration only apply to MySQL)

  ++ migrating 20161024212538

     -> CREATE TEMPORARY TABLE __temp__wallabag_oauth2_clients AS SELECT id, random_id, redirect_uris, secret, allowed_grant_types, name FROM wallabag_oauth2_clients
     -> DROP TABLE wallabag_oauth2_clients
     -> CREATE TABLE wallabag_oauth2_clients (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, allowed_grant_types CLOB NOT NULL COLLATE BINARY, name CLOB DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id), CONSTRAINT IDX_user_oauth_client FOREIGN KEY (user_id) REFERENCES wallabag_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)
     -> INSERT INTO wallabag_oauth2_clients (id, random_id, redirect_uris, secret, allowed_grant_types, name) SELECT id, random_id, redirect_uris, secret, allowed_grant_types, name FROM __temp__wallabag_oauth2_clients
     -> DROP TABLE __temp__wallabag_oauth2_clients
     -> CREATE INDEX IDX_635D765EA76ED395 ON wallabag_oauth2_clients (user_id)

  ++ migrated (0.18s)

  ++ migrating 20161031132655

     -> INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('download_images_enabled', 0, 'misc')

  ++ migrated (0s)

  ++ migrating 20161104073720

     -> DROP INDEX IDX_F4D18282A76ED395
     -> CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, uuid FROM wallabag_entry
     -> DROP TABLE wallabag_entry
     -> CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', uuid CLOB DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
     -> INSERT INTO wallabag_entry (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, uuid) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, uuid FROM __temp__wallabag_entry
     -> DROP TABLE __temp__wallabag_entry
     -> CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
     -> CREATE INDEX IDX_entry_created_at ON wallabag_entry (created_at)

  ++ migrated (1.84s)

  ++ migrating 20161106113822

     -> ALTER TABLE wallabag_config ADD COLUMN action_mark_as_read INTEGER DEFAULT 0

  ++ migrated (0.13s)

  ++ migrating 20161117071626

     -> INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_unmark', 0, 'entry')
     -> INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')

  ++ migrated (0s)

  ++ migrating 20161118134328

     -> ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL

  ++ migrated (0.14s)

  ++ migrating 20161122144743

     -> INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('restricted_access', 0, 'entry')

  ++ migrated (0s)

  ++ migrating 20161122203647

     -> DROP INDEX UNIQ_1D63E7E5C05FB297
     -> DROP INDEX UNIQ_1D63E7E5A0D96FBF
     -> DROP INDEX UNIQ_1D63E7E592FC23A8
     -> CREATE TEMPORARY TABLE __temp__wallabag_user AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expires_at, confirmation_token, password_requested_at, roles, credentials_expire_at, name, created_at, updated_at, authCode, twoFactorAuthentication, trusted FROM wallabag_user
     -> DROP TABLE wallabag_user
     -> CREATE TABLE wallabag_user (id INTEGER NOT NULL, username VARCHAR(180) NOT NULL COLLATE BINARY, username_canonical VARCHAR(180) NOT NULL COLLATE BINARY, email VARCHAR(180) NOT NULL COLLATE BINARY, email_canonical VARCHAR(180) NOT NULL COLLATE BINARY, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL COLLATE BINARY, password VARCHAR(255) NOT NULL COLLATE BINARY, last_login DATETIME DEFAULT NULL, locked BOOLEAN NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL COLLATE BINARY, credentials_expire_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted CLOB DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
     -> INSERT INTO wallabag_user (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expires_at, confirmation_token, password_requested_at, roles, credentials_expire_at, name, created_at, updated_at, authCode, twoFactorAuthentication, trusted) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expires_at, confirmation_token, password_requested_at, roles, credentials_expire_at, name, created_at, updated_at, authCode, twoFactorAuthentication, trusted FROM __temp__wallabag_user
     -> DROP TABLE __temp__wallabag_user
     -> CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON wallabag_user (confirmation_token)
     -> CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON wallabag_user (email_canonical)
     -> CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON wallabag_user (username_canonical)

  ++ migrated (0.16s)

  ++ migrating 20161128084725

     -> ALTER TABLE wallabag_config ADD COLUMN list_mode INTEGER DEFAULT NULL

  ++ migrated (0.13s)

  ++ migrating 20161128131503

     -> DROP INDEX UNIQ_1D63E7E592FC23A8
     -> DROP INDEX UNIQ_1D63E7E5A0D96FBF
     -> DROP INDEX UNIQ_1D63E7E5C05FB297
     -> CREATE TEMPORARY TABLE __temp__wallabag_user AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication, trusted FROM wallabag_user
     -> DROP TABLE wallabag_user
     -> CREATE TABLE wallabag_user (id INTEGER NOT NULL, username VARCHAR(180) NOT NULL COLLATE BINARY, username_canonical VARCHAR(180) NOT NULL COLLATE BINARY, email VARCHAR(180) NOT NULL COLLATE BINARY, email_canonical VARCHAR(180) NOT NULL COLLATE BINARY, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL COLLATE BINARY, password VARCHAR(255) NOT NULL COLLATE BINARY, last_login DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL COLLATE BINARY, name CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted CLOB DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
     -> INSERT INTO wallabag_user (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication, trusted) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication, trusted FROM __temp__wallabag_user
     -> DROP TABLE __temp__wallabag_user
     -> CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON wallabag_user (username_canonical)
     -> CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON wallabag_user (email_canonical)
     -> CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON wallabag_user (confirmation_token)

  ++ migrated (0.16s)

  ++ migrating 20161214094402

     -> CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM wallabag_entry
     -> DROP TABLE wallabag_entry
     -> CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid CLOB DEFAULT NULL COLLATE BINARY, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT "0", PRIMARY KEY(id));
     -> INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public) SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM __temp__wallabag_entry;
     -> DROP TABLE __temp__wallabag_entry

  ++ migrated (1.55s)

  ++ migrating 20161214094403

     -> CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM wallabag_entry
     -> DROP TABLE wallabag_entry
     -> CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid CLOB DEFAULT NULL COLLATE BINARY, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '"0"', PRIMARY KEY(id))
     -> INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM __temp__wallabag_entry
     -> DROP TABLE __temp__wallabag_entry
     -> CREATE INDEX IDX_entry_uid ON wallabag_entry (uid)

  ++ migrated (1.47s)

  ++ migrating 20170127093841

     -> DROP INDEX IDX_entry_uid
     -> CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM wallabag_entry
     -> DROP TABLE wallabag_entry
     -> CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid CLOB DEFAULT NULL COLLATE BINARY, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '"0"', PRIMARY KEY(id))
     -> INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM __temp__wallabag_entry
     -> DROP TABLE __temp__wallabag_entry
     -> CREATE INDEX IDX_entry_uid ON wallabag_entry (uid)
     -> CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
     -> CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)

  ++ migrated (2.67s)

  ------------------------

  ++ finished in 8.43s
  ++ 15 migrations executed
  ++ 63 sql queries

Now when I try to log in, I have this error :

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = 0 AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [1, "310", "309", "308", "307", "306", "305", "304", "303", "302", "301", "300", "299"]: SQLSTATE[HY000]: General error: 1 no such column: w0_.http_status").

Obviously some migrations have not been properly applied on my database.

@Aldarone

This comment has been minimized.

Show comment
Hide comment
@Aldarone

Aldarone Jan 28, 2017

Here the output of SELECT * FROM migration_versions :

20160410190541
20160812120952
20160911214952
20160916201049
20161001072726
20161022134138
20161024212538
20161031132655
20161104073720
20161106113822
20161117071626
20161118134328
20161122144743
20161122203647
20161128084725
20161128131503
20161214094402
20161214094403
20170127093841

The missing column is defined in the version 20161118134328, so I played the following statement manually :

ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL

For now Wallabag seems fine, I can login, read some articles, share them or save new ones with Wallabagger.

But that doesn't tells us why Doctrine didn't applied this migration even though it did say so.

Here the output of SELECT * FROM migration_versions :

20160410190541
20160812120952
20160911214952
20160916201049
20161001072726
20161022134138
20161024212538
20161031132655
20161104073720
20161106113822
20161117071626
20161118134328
20161122144743
20161122203647
20161128084725
20161128131503
20161214094402
20161214094403
20170127093841

The missing column is defined in the version 20161118134328, so I played the following statement manually :

ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL

For now Wallabag seems fine, I can login, read some articles, share them or save new ones with Wallabagger.

But that doesn't tells us why Doctrine didn't applied this migration even though it did say so.

@Alwaysin

This comment has been minimized.

Show comment
Hide comment
@Alwaysin

Alwaysin Jan 28, 2017

Not sure if the same thing but:

Migrating up to 20170127093841 from 0

++ migrating 20160410190541

 -> INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_public', '1', 'entry')

Migration 20160410190541 failed during Execution. Error An exception occurred while executing 'INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_public', '1', 'entry')':

SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

[Doctrine\DBAL\Exception\UniqueConstraintViolationException]
An exception occurred while executing 'INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES (
'share_public', '1', 'entry')':
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

Not sure if the same thing but:

Migrating up to 20170127093841 from 0

++ migrating 20160410190541

 -> INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_public', '1', 'entry')

Migration 20160410190541 failed during Execution. Error An exception occurred while executing 'INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_public', '1', 'entry')':

SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

[Doctrine\DBAL\Exception\UniqueConstraintViolationException]
An exception occurred while executing 'INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES (
'share_public', '1', 'entry')':
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wallabag_craue_config_setting.name

@gege2b

This comment has been minimized.

Show comment
Hide comment
@gege2b

gege2b Jan 28, 2017

Hi

I got the two same two problems too, but given the (different) error I had ( #2797 ) I've supposed these errors was my fault

edit: To get rid of the unique constraint problem, I had to manually migrate all versions individually, as explained here
Some of the first versions was already applied, hence the constraint violation

gege2b commented Jan 28, 2017

Hi

I got the two same two problems too, but given the (different) error I had ( #2797 ) I've supposed these errors was my fault

edit: To get rid of the unique constraint problem, I had to manually migrate all versions individually, as explained here
Some of the first versions was already applied, hence the constraint violation

@benediktg

This comment has been minimized.

Show comment
Hide comment
@benediktg

benediktg Jan 29, 2017

Maybe this is similar:

I have a setup with nginx, PHP7-FPM and PostgreSQL on openSUSE Leap 42.2 and use the tar archives for shared hosting because I prefer extracting tar archives over dealing with that composer stuff. So I had to do these migrations by hand and now I get

500: Internal Server Error

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = false AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [3, 3549, 3546, 3545, 3544, 3542, 3541, 3540, 3539, 3538, 3537, 3536, 3535, 62, 64, 65, 66, 67, 69, 72, 76, 77, 81, 82, 87, 91, 94, 95, 98, 100, 101, 105, 109, 110, 111, 113, 118, 119, 120, 124, 126, 127, 128, 129, 130, 131, 132, 134, 136, 137, 139, 141, 148, 150, 168, 175, 178, 179, 184, 185, 191]: SQLSTATE[42703]: Undefined column: 7 FEHLER: Spalte w0_.uid existiert nicht LINE 1: SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_... ^").

after login. Some of those SQL statements of the migrations returned errors, like

FEHLER:  doppelter Schlüsselwert verletzt Unique-Constraint »wallabag_craue_config_setting_pkey«
(ERROR: double key value hurts unique constraint »wallabag_craue_config_setting_pkey«)

and

FEHLER:  Spalte »uid« existiert nicht
(ERROR: column »uid« does not exist)

Maybe this is similar:

I have a setup with nginx, PHP7-FPM and PostgreSQL on openSUSE Leap 42.2 and use the tar archives for shared hosting because I prefer extracting tar archives over dealing with that composer stuff. So I had to do these migrations by hand and now I get

500: Internal Server Error

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = false AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [3, 3549, 3546, 3545, 3544, 3542, 3541, 3540, 3539, 3538, 3537, 3536, 3535, 62, 64, 65, 66, 67, 69, 72, 76, 77, 81, 82, 87, 91, 94, 95, 98, 100, 101, 105, 109, 110, 111, 113, 118, 119, 120, 124, 126, 127, 128, 129, 130, 131, 132, 134, 136, 137, 139, 141, 148, 150, 168, 175, 178, 179, 184, 185, 191]: SQLSTATE[42703]: Undefined column: 7 FEHLER: Spalte w0_.uid existiert nicht LINE 1: SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_... ^").

after login. Some of those SQL statements of the migrations returned errors, like

FEHLER:  doppelter Schlüsselwert verletzt Unique-Constraint »wallabag_craue_config_setting_pkey«
(ERROR: double key value hurts unique constraint »wallabag_craue_config_setting_pkey«)

and

FEHLER:  Spalte »uid« existiert nicht
(ERROR: column »uid« does not exist)
@FrenchHope

This comment has been minimized.

Show comment
Hide comment
@FrenchHope

FrenchHope Jan 29, 2017

Contributor

I also had an error at 20161022134138 step

ALTER DATABASE wallabag CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

...query didn't worked.

I replaced MySQL with MariaDB a few years ago, maybe an incompatibility ?

To bypass this issue I reduced the length of columns from 255 to 155 (shorter), ran the query on each table instead of full database. Then increased them to 255 again. Hope it is equivalent...

Then I ran other queries of this update step :

ALTER TABLE wallabag_user CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;
ALTER TABLE wallabag_user CHANGE salt salt VARCHAR(180) NOT NULL;
ALTER TABLE wallabag_user CHANGE password password VARCHAR(180) NOT NULL;
ALTER TABLE wallabag_annotation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_entry CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_tag CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_user CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_annotation CHANGE text text longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_annotation CHANGE quote quote VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_entry CHANGE title title longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_entry CHANGE content content longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_tag CHANGE label label longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_user CHANGE name name longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Then I ran other updates from the command line :

bin/console doctrine:migrations:execute 20161024212538 --env=prod
bin/console doctrine:migrations:execute 20161031132655 --env=prod
bin/console doctrine:migrations:execute 20161104073720 --env=prod
bin/console doctrine:migrations:execute 20161106113822 --env=prod
bin/console doctrine:migrations:execute 20161117071626 --env=prod
bin/console doctrine:migrations:execute 20161118134328 --env=prod
bin/console doctrine:migrations:execute 20161122144743 --env=prod
bin/console doctrine:migrations:execute 20161122203647 --env=prod
bin/console doctrine:migrations:execute 20161128084725 --env=prod
bin/console doctrine:migrations:execute 20161128131503 --env=prod
bin/console doctrine:migrations:execute 20161214094402 --env=prod
bin/console doctrine:migrations:execute 20161214094403 --env=prod
bin/console doctrine:migrations:execute 20170127093841 --env=prod

Wallabag seems to work well now.

@benediktg I think you forgot or had an issue with 20161214094402 step

ALTER TABLE wallabag_entry CHANGE uuid uid VARCHAR(23)

@nicosomb do you think I could have issues in the future since I did 20161022134138 step manually ?

Should I add 20161022134138 in 'migration_versions' ?

Contributor

FrenchHope commented Jan 29, 2017

I also had an error at 20161022134138 step

ALTER DATABASE wallabag CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

...query didn't worked.

I replaced MySQL with MariaDB a few years ago, maybe an incompatibility ?

To bypass this issue I reduced the length of columns from 255 to 155 (shorter), ran the query on each table instead of full database. Then increased them to 255 again. Hope it is equivalent...

Then I ran other queries of this update step :

ALTER TABLE wallabag_user CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;
ALTER TABLE wallabag_user CHANGE salt salt VARCHAR(180) NOT NULL;
ALTER TABLE wallabag_user CHANGE password password VARCHAR(180) NOT NULL;
ALTER TABLE wallabag_annotation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_entry CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_tag CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_user CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_annotation CHANGE text text longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_annotation CHANGE quote quote VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_entry CHANGE title title longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_entry CHANGE content content longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_tag CHANGE label label longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE wallabag_user CHANGE name name longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Then I ran other updates from the command line :

bin/console doctrine:migrations:execute 20161024212538 --env=prod
bin/console doctrine:migrations:execute 20161031132655 --env=prod
bin/console doctrine:migrations:execute 20161104073720 --env=prod
bin/console doctrine:migrations:execute 20161106113822 --env=prod
bin/console doctrine:migrations:execute 20161117071626 --env=prod
bin/console doctrine:migrations:execute 20161118134328 --env=prod
bin/console doctrine:migrations:execute 20161122144743 --env=prod
bin/console doctrine:migrations:execute 20161122203647 --env=prod
bin/console doctrine:migrations:execute 20161128084725 --env=prod
bin/console doctrine:migrations:execute 20161128131503 --env=prod
bin/console doctrine:migrations:execute 20161214094402 --env=prod
bin/console doctrine:migrations:execute 20161214094403 --env=prod
bin/console doctrine:migrations:execute 20170127093841 --env=prod

Wallabag seems to work well now.

@benediktg I think you forgot or had an issue with 20161214094402 step

ALTER TABLE wallabag_entry CHANGE uuid uid VARCHAR(23)

@nicosomb do you think I could have issues in the future since I did 20161022134138 step manually ?

Should I add 20161022134138 in 'migration_versions' ?

@NerosTie

This comment has been minimized.

Show comment
Hide comment
@NerosTie

NerosTie Jan 29, 2017

Same issue here (500: Internal Server Error An exception has been thrown during the rendering of a template…) with SQLite. Can I go back?

Same issue here (500: Internal Server Error An exception has been thrown during the rendering of a template…) with SQLite. Can I go back?

@azrdev

This comment has been minimized.

Show comment
Hide comment
@azrdev

azrdev Jan 29, 2017

my wallabag just broke, too, with the upgrade from 2.1.5 to 2.2. Second run of make update printed the migrations as above, they didn't turn up in the first run. Then, I got this error on the web:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = 0 AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [1, "466", "465", "464", "463", "462", "461", "460", "459", "458", "457", "449"]: SQLSTATE[HY000]: General error: 1 no such column: w0_.http_status").

Which I could resolve by re-applying the db migration which introduced w0_.http_status:

$ bin/console doctrine:migrations:execute 20161118134328 --env=prod
(...)
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: migration_versions.version
(...)

$ bin/console doctrine:migrations:execute 20161118134328 --down --env=prod
  -- reverting 20161118134328
  SS skipped (Reason: It seems that you already played this migration.)

$ bin/console doctrine:migrations:execute 20161118134328 --up --env=prod
  ++ migrating 20161118134328
     -> ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL
  ++ migrated (0.17s)

seems to work fine now.

azrdev commented Jan 29, 2017

my wallabag just broke, too, with the upgrade from 2.1.5 to 2.2. Second run of make update printed the migrations as above, they didn't turn up in the first run. Then, I got this error on the web:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = 0 AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [1, "466", "465", "464", "463", "462", "461", "460", "459", "458", "457", "449"]: SQLSTATE[HY000]: General error: 1 no such column: w0_.http_status").

Which I could resolve by re-applying the db migration which introduced w0_.http_status:

$ bin/console doctrine:migrations:execute 20161118134328 --env=prod
(...)
SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: migration_versions.version
(...)

$ bin/console doctrine:migrations:execute 20161118134328 --down --env=prod
  -- reverting 20161118134328
  SS skipped (Reason: It seems that you already played this migration.)

$ bin/console doctrine:migrations:execute 20161118134328 --up --env=prod
  ++ migrating 20161118134328
     -> ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL
  ++ migrated (0.17s)

seems to work fine now.

@benediktg

This comment has been minimized.

Show comment
Hide comment
@benediktg

benediktg Jan 29, 2017

@FrenchHope

I think you forgot or had an issue with 20161214094402 step

ALTER TABLE wallabag_entry CHANGE uuid uid VARCHAR(23)

I have PostgreSQL and there is no alter table ... change ... (https://www.postgresql.org/docs/9.4/static/sql-altertable.html) so it causes a syntax error.

But doing

ALTER TABLE wallabag_entry RENAME COLUMN uuid TO uid;

instead seemed to do the job. ;)

@FrenchHope

I think you forgot or had an issue with 20161214094402 step

ALTER TABLE wallabag_entry CHANGE uuid uid VARCHAR(23)

I have PostgreSQL and there is no alter table ... change ... (https://www.postgresql.org/docs/9.4/static/sql-altertable.html) so it causes a syntax error.

But doing

ALTER TABLE wallabag_entry RENAME COLUMN uuid TO uid;

instead seemed to do the job. ;)

@j0k3r j0k3r closed this Jan 30, 2017

@j0k3r j0k3r reopened this Jan 30, 2017

@j0k3r j0k3r added Bug Urgent labels Jan 30, 2017

@nicosomb

This comment has been minimized.

Show comment
Hide comment
@nicosomb

nicosomb Jan 30, 2017

Member

@FrenchHope > Should I add 20161022134138 in 'migration_versions' ?

Yes, you should.

For all, I also noticed that the migration command told that all is fine but some migrations are not well played (like for http_status column).
I need more time to investigate on this issue. Will do that tonight.

I fixed this error (ping @Alwaysin):

Migration 20160410190541 failed during Execution. Error An exception occurred while executing 'INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_public', '1', 'entry')':

I added hardcoded query for 20161214094402 migration (ALTER TABLE wallabag_entry CHANGE uuid uid VARCHAR(23)). I forgot it.

I open a new Work in progress pull request for these fixes.

Member

nicosomb commented Jan 30, 2017

@FrenchHope > Should I add 20161022134138 in 'migration_versions' ?

Yes, you should.

For all, I also noticed that the migration command told that all is fine but some migrations are not well played (like for http_status column).
I need more time to investigate on this issue. Will do that tonight.

I fixed this error (ping @Alwaysin):

Migration 20160410190541 failed during Execution. Error An exception occurred while executing 'INSERT INTO wallabag_craue_config_setting (name, value, section) VALUES ('share_public', '1', 'entry')':

I added hardcoded query for 20161214094402 migration (ALTER TABLE wallabag_entry CHANGE uuid uid VARCHAR(23)). I forgot it.

I open a new Work in progress pull request for these fixes.

@nicosomb

This comment has been minimized.

Show comment
Hide comment
@nicosomb

nicosomb Jan 30, 2017

Member

Hi there.

I just wrote a fix (it's a draft) for SQLite migrations: https://gist.github.com/nicosomb/7c537995f2b845a30b4d6cdf23c1e22c
Can you try this fix and tell me if it looks OK or not for you?

Member

nicosomb commented Jan 30, 2017

Hi there.

I just wrote a fix (it's a draft) for SQLite migrations: https://gist.github.com/nicosomb/7c537995f2b845a30b4d6cdf23c1e22c
Can you try this fix and tell me if it looks OK or not for you?

@Pablo2048

This comment has been minimized.

Show comment
Hide comment
@Pablo2048

Pablo2048 Jan 31, 2017

Hmm, not working for me - now I'm seeing this even when i recover Wallabag from backup:

500: Internal Server Error

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id_0 FROM (SELECT w0_.id AS id_0, w0_.uuid AS uuid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14 FROM wallabag_entry w0_ LEFT JOIN wallabag_user w1_ ON w0_.user_id = w1_.id WHERE w1_.id = ? AND w0_.is_archived = 0 ORDER BY w0_.created_at DESC) dctrn_result) dctrn_table' with params [1]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'w0_.uuid' in 'field list'") in "WallabagCoreBundle:Entry:entries.html.twig" at line 14.

Hmm, not working for me - now I'm seeing this even when i recover Wallabag from backup:

500: Internal Server Error

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id_0 FROM (SELECT w0_.id AS id_0, w0_.uuid AS uuid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14 FROM wallabag_entry w0_ LEFT JOIN wallabag_user w1_ ON w0_.user_id = w1_.id WHERE w1_.id = ? AND w0_.is_archived = 0 ORDER BY w0_.created_at DESC) dctrn_result) dctrn_table' with params [1]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'w0_.uuid' in 'field list'") in "WallabagCoreBundle:Entry:entries.html.twig" at line 14.

@Pablo2048

This comment has been minimized.

Show comment
Hide comment
@Pablo2048

Pablo2048 Jan 31, 2017

Hmm, it seems like I screwed something up. I've forgot that I've changed DB to MySQL so my Wallabag is not working anymore :-(

Hmm, it seems like I screwed something up. I've forgot that I've changed DB to MySQL so my Wallabag is not working anymore :-(

@nicosomb

This comment has been minimized.

Show comment
Hide comment
@nicosomb

nicosomb Jan 31, 2017

Member

@Pablo2048 You need to execute the migration on your mysql database.

Member

nicosomb commented Jan 31, 2017

@Pablo2048 You need to execute the migration on your mysql database.

@nicosomb

This comment has been minimized.

Show comment
Hide comment
@nicosomb

nicosomb Jan 31, 2017

Member

Migrations issues should be fixed with last release.

/all: can you confirm that?

Member

nicosomb commented Jan 31, 2017

Migrations issues should be fixed with last release.

/all: can you confirm that?

@yoannsculo

This comment has been minimized.

Show comment
Hide comment
@yoannsculo

yoannsculo Jan 31, 2017

Hello,

I have the same issue here (from 2.1.1)
I tried your fix like you told me on IRC https://gist.github.com/nicosomb/7c537995f2b845a30b4d6cdf23c1e22c

But unfortunately, I get an error at the first command:

$ php bin/console doctrine:migration:execute 20161024212538 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161024212538


                                                                                                                               
  [Doctrine\DBAL\Exception\UniqueConstraintViolationException]                                                                 
  An exception occurred while executing 'INSERT INTO migration_versions (version) VALUES (?)' with params ["20161024212538"]:  
  SQLSTATE[23000]: Integrity constraint violation: 19 column version is not unique                                             
                                                                                                                               

                                                                                    
  [Doctrine\DBAL\Driver\PDOException]                                               
  SQLSTATE[23000]: Integrity constraint violation: 19 column version is not unique  
                                                                                    

                                                                                    
  [PDOException]                                                                    
  SQLSTATE[23000]: Integrity constraint violation: 19 column version is not unique  
                                                                                    

doctrine:migrations:execute [--write-sql] [--dry-run] [--up] [--down] [--query-time] [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--db DB] [--em EM] [--shard SHARD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <version>

then I tried

$ sqlite3 data/db/wallabag.sqlite
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> delete from migration_versions where version = "20161024212538";
Error: attempt to write a readonly database

Hello,

I have the same issue here (from 2.1.1)
I tried your fix like you told me on IRC https://gist.github.com/nicosomb/7c537995f2b845a30b4d6cdf23c1e22c

But unfortunately, I get an error at the first command:

$ php bin/console doctrine:migration:execute 20161024212538 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161024212538


                                                                                                                               
  [Doctrine\DBAL\Exception\UniqueConstraintViolationException]                                                                 
  An exception occurred while executing 'INSERT INTO migration_versions (version) VALUES (?)' with params ["20161024212538"]:  
  SQLSTATE[23000]: Integrity constraint violation: 19 column version is not unique                                             
                                                                                                                               

                                                                                    
  [Doctrine\DBAL\Driver\PDOException]                                               
  SQLSTATE[23000]: Integrity constraint violation: 19 column version is not unique  
                                                                                    

                                                                                    
  [PDOException]                                                                    
  SQLSTATE[23000]: Integrity constraint violation: 19 column version is not unique  
                                                                                    

doctrine:migrations:execute [--write-sql] [--dry-run] [--up] [--down] [--query-time] [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--db DB] [--em EM] [--shard SHARD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <version>

then I tried

$ sqlite3 data/db/wallabag.sqlite
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> delete from migration_versions where version = "20161024212538";
Error: attempt to write a readonly database
@nicosomb

This comment has been minimized.

Show comment
Hide comment
@nicosomb

nicosomb Jan 31, 2017

Member

Error: attempt to write a readonly database

It's a problem with sqlite ... you can't open it if this database is still used.
Or you don't have permissions with your user to edit this file.

Member

nicosomb commented Jan 31, 2017

Error: attempt to write a readonly database

It's a problem with sqlite ... you can't open it if this database is still used.
Or you don't have permissions with your user to edit this file.

@yoannsculo

This comment has been minimized.

Show comment
Hide comment
@yoannsculo

yoannsculo Jan 31, 2017

You are right, some directories were owned by www-data user instead of me.

I was able to successfully apply your fix:

$ sqlite3 data/db/wallabag.sqlite
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> delete from migration_versions where version = "20161024212538";
sqlite> delete from migration_versions where version = "20161106113822";
sqlite> delete from migration_versions where version = "20161118134328";
sqlite> delete from migration_versions where version = "20161128084725";
sqlite> delete from migration_versions where version = "20161214094402";
$ php bin/console doctrine:migration:execute 20161024212538 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161024212538


  SS skipped (Reason: It seems that you already played this migration.)

$ php bin/console doctrine:migration:execute 20161106113822 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161106113822


  SS skipped (Reason: It seems that you already played this migration.)

$ php bin/console doctrine:migration:execute 20161118134328 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161118134328

     -> ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL

  ++ migrated (0.35s)

$ php bin/console doctrine:migration:execute 20161128084725 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161128084725


  SS skipped (Reason: It seems that you already played this migration.)

$ php bin/console doctrine:migration:execute 20161214094402 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161214094402


  SS skipped (Reason: It seems that you already played this migration.)

Now I have a Wallabag 2.2.1 up and running :)

Thank you for your help and your work on Wallabag!! :)

yoannsculo commented Jan 31, 2017

You are right, some directories were owned by www-data user instead of me.

I was able to successfully apply your fix:

$ sqlite3 data/db/wallabag.sqlite
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> delete from migration_versions where version = "20161024212538";
sqlite> delete from migration_versions where version = "20161106113822";
sqlite> delete from migration_versions where version = "20161118134328";
sqlite> delete from migration_versions where version = "20161128084725";
sqlite> delete from migration_versions where version = "20161214094402";
$ php bin/console doctrine:migration:execute 20161024212538 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161024212538


  SS skipped (Reason: It seems that you already played this migration.)

$ php bin/console doctrine:migration:execute 20161106113822 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161106113822


  SS skipped (Reason: It seems that you already played this migration.)

$ php bin/console doctrine:migration:execute 20161118134328 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161118134328

     -> ALTER TABLE wallabag_entry ADD COLUMN http_status VARCHAR(3) DEFAULT NULL

  ++ migrated (0.35s)

$ php bin/console doctrine:migration:execute 20161128084725 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161128084725


  SS skipped (Reason: It seems that you already played this migration.)

$ php bin/console doctrine:migration:execute 20161214094402 -e=prod
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20161214094402


  SS skipped (Reason: It seems that you already played this migration.)

Now I have a Wallabag 2.2.1 up and running :)

Thank you for your help and your work on Wallabag!! :)

@FrenchHope

This comment has been minimized.

Show comment
Hide comment
@FrenchHope

FrenchHope Jan 31, 2017

Contributor

@nicosomb everything's OK now. Thanks !

Contributor

FrenchHope commented Jan 31, 2017

@nicosomb everything's OK now. Thanks !

@nicosomb

This comment has been minimized.

Show comment
Hide comment
@nicosomb

nicosomb Jan 31, 2017

Member

🎉

Member

nicosomb commented Jan 31, 2017

🎉

@nicosomb nicosomb closed this Jan 31, 2017

@j0k3r j0k3r added this to the 2.2.1 milestone Jan 31, 2017

@gege2b

This comment has been minimized.

Show comment
Hide comment
@gege2b

gege2b Feb 1, 2017

Database migration is OK now, thank you

But I still get the (original) issue mentionned on #2797 with the "composer.phar not found"

gege2b commented Feb 1, 2017

Database migration is OK now, thank you

But I still get the (original) issue mentionned on #2797 with the "composer.phar not found"

@zertrin

This comment has been minimized.

Show comment
Hide comment
@zertrin

zertrin Feb 27, 2017

Contributor

Wondering: I just got to upgrade fro 2.1.6 to 2.2.1 by following the documentation (make update, then php bin/console doctrine:migrations:migrate --no-interaction -e=prod) and I still got the issue:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = 0 AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [1, "353", "352", "351", "350", "349", "348", "347", "346", "344", "342", "341", "340"]: SQLSTATE[HY000]: General error: 1 no such column: w0_.http_status").

I see this issue was closed. Did the fix make it in a version later than 2.2.1? Because for me 2.2.1 is still broken coming from 2.1.6 and thus this issue shouldn't be closed until it is fixed or the workaround is documented in the upgrade documentation.

Contributor

zertrin commented Feb 27, 2017

Wondering: I just got to upgrade fro 2.1.6 to 2.2.1 by following the documentation (make update, then php bin/console doctrine:migrations:migrate --no-interaction -e=prod) and I still got the issue:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT w0_.id AS id_0, w0_.uid AS uid_1, w0_.title AS title_2, w0_.url AS url_3, w0_.is_archived AS is_archived_4, w0_.is_starred AS is_starred_5, w0_.content AS content_6, w0_.created_at AS created_at_7, w0_.updated_at AS updated_at_8, w0_.mimetype AS mimetype_9, w0_.language AS language_10, w0_.reading_time AS reading_time_11, w0_.domain_name AS domain_name_12, w0_.preview_picture AS preview_picture_13, w0_.is_public AS is_public_14, w0_.http_status AS http_status_15, w0_.user_id AS user_id_16 FROM "wallabag_entry" w0_ WHERE w0_.user_id = ? AND w0_.is_archived = 0 AND w0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY w0_.created_at DESC' with params [1, "353", "352", "351", "350", "349", "348", "347", "346", "344", "342", "341", "340"]: SQLSTATE[HY000]: General error: 1 no such column: w0_.http_status").

I see this issue was closed. Did the fix make it in a version later than 2.2.1? Because for me 2.2.1 is still broken coming from 2.1.6 and thus this issue shouldn't be closed until it is fixed or the workaround is documented in the upgrade documentation.

@zertrin

This comment has been minimized.

Show comment
Hide comment
@zertrin

zertrin Feb 27, 2017

Contributor

Manually applying the steps from https://gist.github.com/nicosomb/7c537995f2b845a30b4d6cdf23c1e22c worked (the only migration not skipped while applying was 20161118134328).

But as said, unless this "just works" while updating according to the documentation (in my case from 2.1.6 to 2.2.1 didn't work as expected) or the documentation being updated for any manual step, I suggest reopening this issue.

Contributor

zertrin commented Feb 27, 2017

Manually applying the steps from https://gist.github.com/nicosomb/7c537995f2b845a30b4d6cdf23c1e22c worked (the only migration not skipped while applying was 20161118134328).

But as said, unless this "just works" while updating according to the documentation (in my case from 2.1.6 to 2.2.1 didn't work as expected) or the documentation being updated for any manual step, I suggest reopening this issue.

@znegva

This comment has been minimized.

Show comment
Hide comment
@znegva

znegva Sep 8, 2017

Problem still exists, upgrading an Installation using SQLite from 2.1.3 to 2.2.3 lead to the problem described above.
Following the steps from @yoannsculo, respectively the gist, solved it.

Maybe this should be added to the upgrade instructions.

znegva commented Sep 8, 2017

Problem still exists, upgrading an Installation using SQLite from 2.1.3 to 2.2.3 lead to the problem described above.
Following the steps from @yoannsculo, respectively the gist, solved it.

Maybe this should be added to the upgrade instructions.

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