-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Migration error: migration file "2.2.17.js" failed #1610
Comments
Also I now went back to the older version and my database is now corrupt: |
I had the same problem.
But another try to upgrade to 2.2.39 magically fixed everything. |
You can't revert to a previous version once the database schema is upgraded (hence why you must always make a backup of your database before upgrading). To fix your original issue (duplicate column error), manually drop the column |
@NGPixel This isn't resolved.
Manually dropped
Now what. edit: Only way I could get this to work was by modifying the UPDATE
pageHistory AS h1
INNER JOIN pageHistory AS h2
ON h2.id =
(SELECT
prev.id
FROM
(SELECT * FROM pageHistory) AS prev # <-- changed pageHistory to (SELECT * FROM pageHistory)
WHERE prev.pageId = h1.pageId
AND prev.id < h1.id
ORDER BY prev.id DESC
LIMIT 1) SET h1.versionDate = h2.createdAt ; Migration needs work. Every time I migrate to a new version, I have to fix something. |
I can confirm this happens when I upgrading from edit, what I think that this error is misleading. Here is the original error before everything messed up
This happens on MySQL 8.0.19 edit: Using patch from @fireundubh works |
Upon further testing, this bug is specific to MySQL. MariaDB accepts the original query just fine. Testing is usually done with only one of them, as until now they always acted identical. Migrations will be tested with both engines going forward. A fix is coming in 2.2.51. |
hmm I'm curious, what MariaDB version do you use? |
Used latest docker build, which is 10.4.12 at the moment. |
Fixed by 3613c73, now available as 2.2.51 |
Since I neglected to include my DB version, this is my MariaDB version: 10.2.19-MariaDB-10.2.19+maria~xenial-log.
Great! Thank you. edit: @NGPixel I looked at the commit. I think you might need a way to check the MariaDB version - because 10.2 does not support the current MariaDB query. I'm not sure what changed between 10.2, 10.3, and 10.4 that allows that query as-is to run successfully in 10.4, but I've upgraded to 10.4 to hopefully avoid future issues like this. |
@NGPixel I can confirm, that the fix in 2.2.51 does not work with MariaDB version 10.2.31. I think there is still the need for another fix. edit: I changed the line for case mariadb the same way as for the mysql query and it worked with MariaDB 10.2. Seems like MariaDB 10.2 does not support the query you used for case mariadb. Unfortunately I can't upgrade to MariaDB 10.4 for now, so I had to change something. |
wow, just a different minor number and the migration is broken. Really interesting case 🤔 btw I tried with MariaDB 10.3 and this migration runs fine. Also with MySQL 5.7.29, I got same error like this. So... I think this is time for change the system requirements? Or just use @fireundubh's patch entirely without differentiating MariaDB and MySQL? |
mariadb migration was changed (245104c) to use the same one as mysql in order to support older mariadb version. |
Describe the bug
The start script errors when trying to migrate.
To Reproduce
Steps to reproduce the behavior:
Screenshots
Source code attached below.
Host Info
Additional context
Console output:
13|Docs | > wiki@2.2.39 start /home/PreMiD/docs
13|Docs | > node server
13|Docs | Loading configuration from /home/PreMiD/docs/config.yml...
13|Docs | OK
13|Docs | 2020-03-23T04:07:23.202Z [MASTER] info: <br=======================================
13|Docs | 2020-03-23T04:07:23.204Z [MASTER] info: = Wiki.js 2.2.39 ======================
13|Docs | 2020-03-23T04:07:23.204Z [MASTER] info: =======================================
13|Docs | 2020-03-23T04:07:23.204Z [MASTER] info: Initializing...
13|Docs | 2020-03-23T04:07:23.643Z [MASTER] info: Using database driver mysql2 for mysql [ OK ]
13|Docs | 2020-03-23T04:07:23.656Z [MASTER] info: Connecting to database...
13|Docs | 2020-03-23T04:07:23.706Z [MASTER] info: Database Connection Successful [ OK ]
13|Docs | migration file "2.2.17.js" failed
13|Docs | migration failed with error: alter table
pageHistory
addversionDate
varchar(255) not null default '' - Duplicate column name 'versionDate'13|Docs | 2020-03-23T04:07:23.762Z [MASTER] error: Database Initialization Error: alter table
pageHistory
addversionDate
varchar(255) not null default '' - Duplicate column name 'versionDate'13|Docs | npm
13|Docs | ERR! code ELIFECYCLE
13|Docs | npm ERR! errno 1
13|Docs | npm ERR!
13|Docs | wiki@2.2.39 start:
node server
13|Docs | npm ERR! Exit status 1
13|Docs | npm ERR!
13|Docs | npm ERR! Failed at the wiki@2.2.39 start script.
13|Docs | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.13|Docs | npm ERR! A complete log of this run can be found in:
13|Docs | npm ERR! /home/.npm/_logs/2020-03-23T04_07_23_778Z-debug.lo
The text was updated successfully, but these errors were encountered: