go-vikunja / vikunja

Mirror of vikunja from https://code.vikunja.io/api
GNU Affero General Public License v3.0
773 stars 56 forks source link

Update 0.21 to 0.22 error #101

Closed hackschnitzel09 closed 6 months ago

hackschnitzel09 commented 6 months ago

Description

Hi, thanks for the new release. I am trying to update to 0.22.0 and got the following errors:

CRITICAL ▶ migration/Migrate 059 Migration failed: migration 20230831155832 failed: Error 1932 (42S02): Table 'vikunja-beta.api_tokens' doesn't exist in engine

When checking via phpadmin I can see the table api_tokens but when I click on it it says #1932 Table "vikunja-beta.api_tockens" doesnt exist in engine

Vikunja Frontend Version

0.21 to 0.22

Vikunja API Version

0.21 to 0.22

Browser and version

Chrome

Can you reproduce the bug on the Vikunja demo site?

No

Screenshots

No response

hackschnitzel09 commented 6 months ago

with a new db it works

hackschnitzel09 commented 6 months ago

since when is the api_tokens table there? Backups from days ago do show it already?

hackschnitzel09 commented 6 months ago

sorry for spam :) what worked for me was: running the db from yesterdays backup export via https://help.dreamhost.com/hc/en-us/articles/214395738-phpMyAdmin-How-to-backup-or-export-a-database-or-table create a new db from and import via https://help.dreamhost.com/hc/en-us/articles/214395768-phpMyAdmin-How-to-import-a-database-or-table

For now everything looks fine

kolaente commented 6 months ago

Maybe also relevant wrt backup and restore: https://vikunja.io/docs/what-to-backup/

RoboMagus commented 6 months ago

Could this issue be re-opened? I'm experiencing the exact same issue.

Hoping there would be a migration implemented for missing tables. Is that possible?

kolaente commented 6 months ago

@RoboMagus there is a migration for missing tables. Is the exact same migration failing for you as well?

RoboMagus commented 6 months ago

It's the same indeed. Here's my docker logs:

Recreating vikunja_api ... done
Attaching to vikunja_api
vikunja_api                    | info: creating the new user vikunja with 1000:1000
vikunja_api                    | usermod: no changes
vikunja_api                    | 2024-01-02T14:03:58.380598585Z: INFO   ▶ config/InitConfig 001 Using config file: /app/vikunja/config.yaml
vikunja_api                    | 2024-01-02T14:03:58.866611262Z: CRITICAL       ▶ migration/Migrate 059 Migration failed: migration 20230831155832 failed: Error 1932 (42S02): Table 'vikunja.api_tokens' doesn't exist in engine
vikunja_api                    | usermod: no changes
vikunja_api                    | 2024-01-02T14:04:00.878618193Z: INFO   ▶ config/InitConfig 001 Using config file: /app/vikunja/config.yaml
vikunja_api                    | 2024-01-02T14:04:01.097685325Z: CRITICAL       ▶ migration/Migrate 059 Migration failed: migration 20230831155832 failed: Error 1932 (42S02): Table 'vikunja.api_tokens' doesn't exist in engine
vikunja_api exited with code 1
kolaente commented 6 months ago

What does not really make sense here is that the migration which complains about the table being missing is the migration which should create that table.

@RoboMagus Does this only happen for you when you update from 0.21 to 0.22?

RoboMagus commented 6 months ago

After I first noticed the error and found this thread I've locked the version of both my API and Frontend containers to 0.21 after which the error no longer showed. The logs above are produced after re-enabling the latest tag, so that would be 0.22.

I'm not sure if there are other scenarios this could be replicated in, as I do not have a succesfully running v0.20 or v0.22 setup I could try this with.

additional info: I'm on linuxserver/mariadb 10.11.5-r0-ls123

kolaente commented 5 months ago

Does it work if you switch to unstable?

hackschnitzel09 commented 5 months ago

Sorry, I am not able to test it anymore

RoboMagus commented 5 months ago

Does it work if you switch to unstable?

Yes, the error persists when currently trying on unstable

kolaente commented 5 months ago

Do you have an entry for 20230831155832 in the migration table?

RoboMagus commented 5 months ago

These are all the entries that appear to be in that table. 20230831155832 appears to be missing.


MariaDB [vikunja]> SELECT * FROM migration;
+----------------+-------------+
| id             | description |
+----------------+-------------+
| SCHEMA_INIT    |             |
| 20190324205606 |             |
| 20190328074430 |             |
| 20190430111111 |             |
| 20190511202210 |             |
| 20190514192749 |             |
| 20190524205441 |             |
| 20190718200716 |             |
| 20190818210133 |             |
| 20190920185205 |             |
| 20190922205826 |             |
| 20191008194238 |             |
| 20191010131430 |             |
| 20191207204427 |             |
| 20191207220736 |             |
| 20200120201756 |             |
| 20200219183248 |             |
| 20200308205855 |             |
| 20200308210130 |             |
| 20200322214440 |             |
| 20200322214624 |             |
| 20200417175201 |             |
| 20200418230432 |             |
| 20200418230605 |             |
| 20200420215928 |             |
| 20200425182634 |             |
| 20200509103709 |             |
| 20200515172220 |             |
| 20200515195546 |             |
| 20200516123847 |             |
| 20200524221534 |             |
| 20200524224611 |             |
| 20200614113230 |             |
| 20200621214452 |             |
| 20200801183357 |             |
| 20200904101559 |             |
| 20200905151040 |             |
| 20200905232458 |             |
| 20200906184746 |             |
| 20201025195822 |             |
| 20201121181647 |             |
| 20201218152741 |             |
| 20201218220204 |             |
| 20201219145028 |             |
| 20210207192805 |             |
| 20210209204715 |             |
| 20210220222121 |             |
| 20210221111953 |             |
| 20210321185225 |             |
| 20210328191017 |             |
| 20210403145503 |             |
| 20210403220653 |             |
| 20210407170753 |             |
| 20210411113105 |             |
| 20210411161337 |             |
| 20210413131057 |             |
| 20210527105701 |             |
| 20210603174608 |             |
| 20210709191101 |             |
| 20210709211508 |             |
| 20210711173657 |             |
| 20210713213622 |             |
| 20210725153703 |             |
| 20210727204942 |             |
| 20210727211037 |             |
| 20210729142940 |             |
| 20210802081716 |             |
| 20210829194722 |             |
| 20211212151642 |             |
| 20220112211537 |             |
| 20211212210054 |             |
| 20220616145228 |             |
| 20220815200851 |             |
| 20221002120521 |             |
| 20221113170740 |             |
| 20221228112131 |             |
| 20230307171848 |             |
| 20230611170341 |             |
| 20230824132533 |             |
| 20230828125443 |             |
+----------------+-------------+
80 rows in set (0.001 sec)

MariaDB [vikunja]>
kolaente commented 5 months ago

Can you enable database logging to see which queries it executes prior to the failing migration?

I'm still unable to reproduce this.

RoboMagus commented 5 months ago

Below are the log results of the API container startup with these lines added to the docker compose envirornment variables:

 VIKUNJA_LOG_DATABASE: stdout
 VIKUNJA_LOG_DATABASELEVEL: debug
vikunja_api                    | info: creating the new user vikunja with 1000:1000
vikunja_api                    | usermod: no changes
vikunja_api                    | 2024-01-28T20:51:23.007708403Z: INFO   ▶ config/InitConfig 001 Using config file: /app/vikunja/config.yaml
vikunja_api                    | 2024-01-28T20:51:23.038101475Z: INFO   ▶ [DATABASE] 002 [SQL] SELECT `TABLE_NAME`, `ENGINE`, `AUTO_INCREMENT`, `TABLE_COMMENT`, `TABLE_COLLATION` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [vikunja] - 27.362818ms
vikunja_api                    | 2024-01-28T20:51:23.043678434Z: INFO   ▶ [DATABASE] 003 [SQL] SELECT `COLUMN_NAME`, `IS_NULLABLE`, `COLUMN_DEFAULT`, `COLUMN_TYPE`, `COLUMN_KEY`, `EXTRA`, `COLUMN_COMMENT`, `CHARACTER_MAXIMUM_LENGTH`, (INSTR(VERSION(), 'maria') > 0 && (SUBSTRING_INDEX(VERSION(), '.', 1) > 10 || (SUBSTRING_INDEX(VERSION(), '.', 1) = 10 && (SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) > 2 || (SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) = 2 && SUBSTRING_INDEX(SUBSTRING(VERSION(), 6), '-', 1) >= 7))))) AS NEEDS_QUOTE, `COLLATION_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? ORDER BY `COLUMNS`.ORDINAL_POSITION ASC [vikunja migration] - 4.812765ms
vikunja_api                    | 2024-01-28T20:51:23.048883953Z: INFO   ▶ [DATABASE] 004 [SQL] SELECT `INDEX_NAME`, `NON_UNIQUE`, `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`STATISTICS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? ORDER BY `SEQ_IN_INDEX` [vikunja migration] - 4.758192ms
vikunja_api                    | 2024-01-28T20:51:23.051883411Z: INFO   ▶ [DATABASE] 005 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [SCHEMA_INIT] - 2.41941ms
vikunja_api                    | 2024-01-28T20:51:23.054443967Z: INFO   ▶ [DATABASE] 006 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190324205606] - 2.231654ms
vikunja_api                    | 2024-01-28T20:51:23.056743472Z: INFO   ▶ [DATABASE] 007 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190328074430] - 1.972787ms
vikunja_api                    | 2024-01-28T20:51:23.059420416Z: INFO   ▶ [DATABASE] 008 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190430111111] - 2.342411ms
vikunja_api                    | 2024-01-28T20:51:23.062395133Z: INFO   ▶ [DATABASE] 009 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190511202210] - 2.599927ms
vikunja_api                    | 2024-01-28T20:51:23.0644719Z: INFO     ▶ [DATABASE] 00a [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190514192749] - 1.724328ms
vikunja_api                    | 2024-01-28T20:51:23.066467909Z: INFO   ▶ [DATABASE] 00b [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190524205441] - 1.640402ms
vikunja_api                    | 2024-01-28T20:51:23.069327054Z: INFO   ▶ [DATABASE] 00c [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190718200716] - 1.874233ms
vikunja_api                    | 2024-01-28T20:51:23.073068668Z: INFO   ▶ [DATABASE] 00d [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190818210133] - 2.479576ms
vikunja_api                    | 2024-01-28T20:51:23.076158384Z: INFO   ▶ [DATABASE] 00e [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190920185205] - 2.429632ms
vikunja_api                    | 2024-01-28T20:51:23.078557628Z: INFO   ▶ [DATABASE] 00f [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20190922205826] - 1.855493ms
vikunja_api                    | 2024-01-28T20:51:23.080442601Z: INFO   ▶ [DATABASE] 010 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20191008194238] - 1.390054ms
vikunja_api                    | 2024-01-28T20:51:23.082502924Z: INFO   ▶ [DATABASE] 011 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20191010131430] - 1.511645ms
vikunja_api                    | 2024-01-28T20:51:23.084160215Z: INFO   ▶ [DATABASE] 012 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20191207204427] - 1.213631ms
vikunja_api                    | 2024-01-28T20:51:23.086108707Z: INFO   ▶ [DATABASE] 013 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20191207220736] - 1.452276ms
vikunja_api                    | 2024-01-28T20:51:23.088867705Z: INFO   ▶ [DATABASE] 014 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200120201756] - 2.283727ms
vikunja_api                    | 2024-01-28T20:51:23.105575821Z: INFO   ▶ [DATABASE] 015 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200219183248] - 13.932267ms
vikunja_api                    | 2024-01-28T20:51:23.10920303Z: INFO    ▶ [DATABASE] 016 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200308205855] - 2.998106ms
vikunja_api                    | 2024-01-28T20:51:23.117060567Z: INFO   ▶ [DATABASE] 017 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200308210130] - 7.132733ms
vikunja_api                    | 2024-01-28T20:51:23.120935642Z: INFO   ▶ [DATABASE] 018 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200322214440] - 3.231954ms
vikunja_api                    | 2024-01-28T20:51:23.127196221Z: INFO   ▶ [DATABASE] 019 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200322214624] - 2.466503ms
vikunja_api                    | 2024-01-28T20:51:23.131675176Z: INFO   ▶ [DATABASE] 01a [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200417175201] - 3.350657ms
vikunja_api                    | 2024-01-28T20:51:23.134655579Z: INFO   ▶ [DATABASE] 01b [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200418230432] - 2.573779ms
vikunja_api                    | 2024-01-28T20:51:23.138813853Z: INFO   ▶ [DATABASE] 01c [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200418230605] - 3.330249ms
vikunja_api                    | 2024-01-28T20:51:23.141380188Z: INFO   ▶ [DATABASE] 01d [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200420215928] - 2.087933ms
vikunja_api                    | 2024-01-28T20:51:23.144753344Z: INFO   ▶ [DATABASE] 01e [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200425182634] - 2.770368ms
vikunja_api                    | 2024-01-28T20:51:23.147803208Z: INFO   ▶ [DATABASE] 01f [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200509103709] - 2.396967ms
vikunja_api                    | 2024-01-28T20:51:23.151993723Z: INFO   ▶ [DATABASE] 020 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200515172220] - 1.897288ms
vikunja_api                    | 2024-01-28T20:51:23.155765448Z: INFO   ▶ [DATABASE] 021 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200515195546] - 3.381878ms
vikunja_api                    | 2024-01-28T20:51:23.158931533Z: INFO   ▶ [DATABASE] 022 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200516123847] - 2.112174ms
vikunja_api                    | 2024-01-28T20:51:23.163082641Z: INFO   ▶ [DATABASE] 023 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200524221534] - 3.33375ms
vikunja_api                    | 2024-01-28T20:51:23.17198109Z: INFO    ▶ [DATABASE] 024 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200524224611] - 6.268097ms
vikunja_api                    | 2024-01-28T20:51:23.209198288Z: INFO   ▶ [DATABASE] 025 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200614113230] - 1.929196ms
vikunja_api                    | 2024-01-28T20:51:23.211439257Z: INFO   ▶ [DATABASE] 026 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200621214452] - 1.453442ms
vikunja_api                    | 2024-01-28T20:51:23.213526302Z: INFO   ▶ [DATABASE] 027 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200801183357] - 1.755623ms
vikunja_api                    | 2024-01-28T20:51:23.216637091Z: INFO   ▶ [DATABASE] 028 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200904101559] - 2.654074ms
vikunja_api                    | 2024-01-28T20:51:23.219041279Z: INFO   ▶ [DATABASE] 029 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200905151040] - 1.598588ms
vikunja_api                    | 2024-01-28T20:51:23.220921494Z: INFO   ▶ [DATABASE] 02a [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200905232458] - 1.395036ms
vikunja_api                    | 2024-01-28T20:51:23.223351719Z: INFO   ▶ [DATABASE] 02b [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20200906184746] - 1.814438ms
vikunja_api                    | 2024-01-28T20:51:23.225585947Z: INFO   ▶ [DATABASE] 02c [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20201025195822] - 1.76542ms
vikunja_api                    | 2024-01-28T20:51:23.22751216Z: INFO    ▶ [DATABASE] 02d [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20201121181647] - 1.353999ms
vikunja_api                    | 2024-01-28T20:51:23.22966476Z: INFO    ▶ [DATABASE] 02e [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20201218152741] - 1.64231ms
vikunja_api                    | 2024-01-28T20:51:23.232191761Z: INFO   ▶ [DATABASE] 02f [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20201218220204] - 1.923621ms
vikunja_api                    | 2024-01-28T20:51:23.234187825Z: INFO   ▶ [DATABASE] 030 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20201219145028] - 1.463701ms
vikunja_api                    | 2024-01-28T20:51:23.236335666Z: INFO   ▶ [DATABASE] 031 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210207192805] - 1.354888ms
vikunja_api                    | 2024-01-28T20:51:23.238539949Z: INFO   ▶ [DATABASE] 032 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210209204715] - 1.530534ms
vikunja_api                    | 2024-01-28T20:51:23.240702363Z: INFO   ▶ [DATABASE] 033 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210220222121] - 1.374184ms
vikunja_api                    | 2024-01-28T20:51:23.24305059Z: INFO    ▶ [DATABASE] 034 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210221111953] - 1.465053ms
vikunja_api                    | 2024-01-28T20:51:23.24532115Z: INFO    ▶ [DATABASE] 035 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210321185225] - 1.580681ms
vikunja_api                    | 2024-01-28T20:51:23.247635747Z: INFO   ▶ [DATABASE] 036 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210328191017] - 1.612403ms
vikunja_api                    | 2024-01-28T20:51:23.249709551Z: INFO   ▶ [DATABASE] 037 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210403145503] - 1.38874ms
vikunja_api                    | 2024-01-28T20:51:23.251958094Z: INFO   ▶ [DATABASE] 038 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210403220653] - 1.477554ms
vikunja_api                    | 2024-01-28T20:51:23.254692555Z: INFO   ▶ [DATABASE] 039 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210407170753] - 2.056396ms
vikunja_api                    | 2024-01-28T20:51:23.256937783Z: INFO   ▶ [DATABASE] 03a [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210411113105] - 1.524423ms
vikunja_api                    | 2024-01-28T20:51:23.259053272Z: INFO   ▶ [DATABASE] 03b [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210411161337] - 1.380222ms
vikunja_api                    | 2024-01-28T20:51:23.261418757Z: INFO   ▶ [DATABASE] 03c [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210413131057] - 1.571015ms
vikunja_api                    | 2024-01-28T20:51:23.263593319Z: INFO   ▶ [DATABASE] 03d [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210527105701] - 1.489035ms
vikunja_api                    | 2024-01-28T20:51:23.266075247Z: INFO   ▶ [DATABASE] 03e [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210603174608] - 1.7939ms
vikunja_api                    | 2024-01-28T20:51:23.268285716Z: INFO   ▶ [DATABASE] 03f [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210709191101] - 1.439702ms
vikunja_api                    | 2024-01-28T20:51:23.271215897Z: INFO   ▶ [DATABASE] 040 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210709211508] - 2.252764ms
vikunja_api                    | 2024-01-28T20:51:23.274909697Z: INFO   ▶ [DATABASE] 041 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210711173657] - 2.965995ms
vikunja_api                    | 2024-01-28T20:51:23.277195164Z: INFO   ▶ [DATABASE] 042 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210713213622] - 1.471665ms
vikunja_api                    | 2024-01-28T20:51:23.279391652Z: INFO   ▶ [DATABASE] 043 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210725153703] - 1.40298ms
vikunja_api                    | 2024-01-28T20:51:23.29015626Z: INFO    ▶ [DATABASE] 044 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210727204942] - 10.059155ms
vikunja_api                    | 2024-01-28T20:51:23.292842277Z: INFO   ▶ [DATABASE] 045 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210727211037] - 1.85127ms
vikunja_api                    | 2024-01-28T20:51:23.295410945Z: INFO   ▶ [DATABASE] 046 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210729142940] - 1.667754ms
vikunja_api                    | 2024-01-28T20:51:23.298276664Z: INFO   ▶ [DATABASE] 047 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210802081716] - 2.093971ms
vikunja_api                    | 2024-01-28T20:51:23.300924404Z: INFO   ▶ [DATABASE] 048 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20210829194722] - 1.544367ms
vikunja_api                    | 2024-01-28T20:51:23.304249617Z: INFO   ▶ [DATABASE] 049 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20211212151642] - 1.920177ms
vikunja_api                    | 2024-01-28T20:51:23.30737624Z: INFO    ▶ [DATABASE] 04a [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20211212210054] - 2.070156ms
vikunja_api                    | 2024-01-28T20:51:23.309832335Z: INFO   ▶ [DATABASE] 04b [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20220112211537] - 1.838381ms
vikunja_api                    | 2024-01-28T20:51:23.311959471Z: INFO   ▶ [DATABASE] 04c [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20220616145228] - 1.606903ms
vikunja_api                    | 2024-01-28T20:51:23.314894282Z: INFO   ▶ [DATABASE] 04d [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20220815200851] - 1.525849ms
vikunja_api                    | 2024-01-28T20:51:23.316831199Z: INFO   ▶ [DATABASE] 04e [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20221002120521] - 1.421128ms
vikunja_api                    | 2024-01-28T20:51:23.318884189Z: INFO   ▶ [DATABASE] 04f [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20221113170740] - 1.315814ms
vikunja_api                    | 2024-01-28T20:51:23.32073444Z: INFO    ▶ [DATABASE] 050 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20221228112131] - 1.225149ms
vikunja_api                    | 2024-01-28T20:51:23.322790485Z: INFO   ▶ [DATABASE] 051 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20230307171848] - 1.532441ms
vikunja_api                    | 2024-01-28T20:51:23.324721199Z: INFO   ▶ [DATABASE] 052 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20230611170341] - 1.394592ms
vikunja_api                    | 2024-01-28T20:51:23.326978593Z: INFO   ▶ [DATABASE] 053 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20230824132533] - 1.561719ms
vikunja_api                    | 2024-01-28T20:51:23.329053657Z: INFO   ▶ [DATABASE] 054 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20230828125443] - 1.419573ms
vikunja_api                    | 2024-01-28T20:51:23.331518177Z: INFO   ▶ [DATABASE] 055 [SQL] SELECT count(*) FROM `migration` WHERE `id` IN (?) [20230831155832] - 1.738291ms
vikunja_api                    | 2024-01-28T20:51:23.338229824Z: INFO   ▶ [DATABASE] 056 [SQL] SELECT `TABLE_NAME`, `ENGINE`, `AUTO_INCREMENT`, `TABLE_COMMENT`, `TABLE_COLLATION` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [vikunja] - 6.211042ms
vikunja_api                    | 2024-01-28T20:51:23.340398089Z: INFO   ▶ [DATABASE] 057 [SQL] CREATE TABLE IF NOT EXISTS `api_tokens` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, `title` VARCHAR(255) NOT NULL, `token_salt` VARCHAR(255) NOT NULL, `token_hash` VARCHAR(255) NOT NULL, `token_last_eight` VARCHAR(8) NOT NULL, `permissions` TEXT NOT NULL, `expires_at` DATETIME NOT NULL, `owner_id` BIGINT(20) NOT NULL, `created` DATETIME NOT NULL) DEFAULT CHARSET utf8mb4 [] - 1.059374ms
vikunja_api                    | 2024-01-28T20:51:23.341433816Z: INFO   ▶ [DATABASE] 058 [SQL] CREATE UNIQUE INDEX `UQE_api_tokens_id` ON `api_tokens` (`id`) [] - 877.728µs
vikunja_api                    | 2024-01-28T20:51:23.341546573Z: CRITICAL       ▶ migration/Migrate 059 Migration failed: migration 20230831155832 failed: Error 1932 (42S02): Table 'vikunja.api_tokens' doesn't exist in engine
kolaente commented 5 months ago

What happens if you run the following sql query in your database?

CREATE TABLE IF NOT EXISTS `api_tokens` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, `title` VARCHAR(255) NOT NULL, `token_salt` VARCHAR(255) NOT NULL, `token_hash` VARCHAR(255) NOT NULL, `token_last_eight` VARCHAR(8) NOT NULL, `permissions` TEXT NOT NULL, `expires_at` DATETIME NOT NULL, `owner_id` BIGINT(20) NOT NULL, `created` DATETIME NOT NULL) DEFAULT CHARSET utf8mb4
RoboMagus commented 5 months ago

What happens if you run the following sql query in your database?

MariaDB [vikunja]> CREATE TABLE IF NOT EXISTS `api_tokens` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, `title` VARCHAR(255) NOT NULL, `token_salt` VARCHAR(255) NOT NULL, `token_hash` VARCHAR(255) NOT NULL, `token_last_eight` VARCHAR(8) NOT NULL, `permissions` TEXT NOT NULL, `expires_at` DATETIME NOT NULL, `owner_id` BIGINT(20) NOT NULL, `created` DATETIME NOT NULL) DEFAULT CHARSET utf8mb4;
Query OK, 0 rows affected, 1 warning (0.001 sec)

It seems that command does not change anything in the DB.

RoboMagus commented 5 months ago

More interesting output follows from these commands:


MariaDB [vikunja]> SHOW TABLES;
+-------------------+
| Tables_in_vikunja |
+-------------------+
| api_tokens        |
| buckets           |
| favorites         |
| files             |
| label_tasks       |
| labels            |
| link_shares       |
| migration         |
| migration_status  |
| notifications     |
| projects          |
| saved_filters     |
| subscriptions     |
| task_assignees    |
| task_attachments  |
| task_comments     |
| task_relations    |
| task_reminders    |
| tasks             |
| team_members      |
| team_projects     |
| teams             |
| totp              |
| typesense_sync    |
| unsplash_photos   |
| user_tokens       |
| users             |
| users_projects    |
+-------------------+
28 rows in set (0.059 sec)

MariaDB [vikunja]> SELECT * FROM api_tokens;
ERROR 1932 (42S02): Table 'vikunja.api_tokens' doesn't exist in engine
MariaDB [vikunja]>
kolaente commented 5 months ago

Are you able to create any other table? Like this:

CREATE TABLE IF NOT EXISTS `test` (`test` VARCHAR(255) NULL) DEFAULT CHARSET utf8mb4

Otherwise, I suspect this to be a problem with your database / engine etc.

Does it work when you recreate the database?

RoboMagus commented 4 months ago

Creating another table using the command you provided worked fine.

In the end I've dumped and restored the entire DB with the exception of the api_tokens and typesense_sync tables, as they were both probably corrupted (showing the doesn't exist in engine error.

So far everything seems to work as expected, and the 0.22 upgrade now also works.

Though with the data from these 2 tables gone I'm wondering what's missing. Is there anything I should look for to reconfigure? (What's contained in the typesense_sync table?)

kolaente commented 4 months ago

Though with the data from these 2 tables gone I'm wondering what's missing. Is there anything I should look for to reconfigure? (What's contained in the typesense_sync table?)

The api_tokens table gone means you won't be able to use the api tokens, the typesense_sync contains information about when the last sync into Typesense happened so that it can collect everything which has changed since then. It is only used when you have the Typesense integration configured.

Does the dump contain the api_tokens and typesense_sync tables?

RoboMagus commented 4 months ago

Thanks for the info. The Typesense integrations is not used and I'm pretty sure api_tokens have not yet been configured as it's a relatively new addition. So based on that I'm guessing no particularly usefull data got lost / has to be reconfigured :)

The dump did not contain the api_tokens and typesense_sync tables, as those were corrupted in the old DB, however were recreated once the Vikunja API container got started again.

Everything looks to be up and running again, with no issues in the last couple of days.

Thank you for your assistance!