Upgrading from 10.9

I’ve been using Directus 10.9.0 with a MariaDB database on a VPS for several years with no issues, but I do remember that I run into issues whenever I installed it in the past, since I’m not really a node dev so if I dumps a ton of error messages it’s too much to analyze.

I’m migrating to a new VPS this week, and I tried to do a fresh install of Directus 11.10. Perhaps obviously, it wouldn’t start with the existing database. I ran “directus database migrate:latest” and Directus starts and shows me my login page. I put in my username and password. It then properly asks for my OTP. But then when I log in it says “Unexpected Error,” and the log shows:

[18:14:27.958] ERROR: select "id', 'parent' from 'directus_roles' where 'id' = '9ab5a25e-755e-408c-a
027-4489527234d0' limit 1 - Unknown column 'parent' in 'SELECT'
err: {
"type": "Error"
"message": "select "id', 'parent' from 'directus_roles' where "id' = '9ab5a25e-755e-408c-a027-
4489527234d0' limit 1 - Unknown column 'parent' in 'SELECT'"
"stack" :
Error: select 'id', 'parent' from 'directus_roles' where "id' = '9ab5a25e-755e-408c-a027-4
489527234d0' limit 1 - Unknown column 'parent' in 'SELECT'
at Packet.asError (/usr/lib/node_modules/directus/node_modules/mysql2/lib/packets/pack
et. js: 738:17)
at Query. execute (/usr/lib/node_modules/directus/node_modules/mysql2/lib/commands/comm
and. js: 29:26)
at Connection.handlePacket (/usr/lib/node_modules/directus/node_modules/mysql2/lib/con
nection. js:481:34)
at PacketParser.onPacket (/usr/lib/node_modules/directus/node_modules/mysql2/lib/conne
ction. js:97:12)
at PacketParser. executeStart (/usr/lib/node_modules/directus/node_modules/mysql2/lib/p
acket_parser. js: 75:16)
at Socket. <anonymous> (/usr/lib/node_modules/directus/node_modules/mysql2/lib/connecti
on. js: 104:25)
at Socket. emit (node: events: 524:28)
at addChunk (node:internal/streams/readable: 561:12)
at readableAddChunkPushByteMode (node: internal/streams/readable: 512:3)
at Readable.push (node: internal/streams/readable: 392:5)
"code": "ER_BAD_FIELD_ERROR",
"errno": 1054,
"sqlState": "42S22"
"sqlMessage": "Unknown column 'parent' in 'SELECT'"
"sql": "select "id
, parent' from 'directus_roles where 'id' = '9ab5a25e-755e-408c-a027-4489
527234d0' limit 1"
[18:14:27] POST / auth/login 500 46ms

So the migration didn’t work properly. I asked (@)Directus on X and they said when running DIrectus like this, I have to run ‘npx directus boostrap’ or ‘npx directus database migrate:latest.’ I did run the latter.

For the time being I reinstalled 10.9.0 and it worked fine on the new VPS.

Today I tried to upgrade from release to release and run ‘npx directus database migrate:up’ as I can’t figure out if ‘migrate:latest’ is migrating to the current version I have installed or 11.10.0 every time, which doesn’t work for me for some reason. So I installed 10.9.1, then 10.9.2, then 10.9.3, running ‘migrate:up’ each time. Each time it told me no changes were necessary, and now 10.9.3 works fine on my VPS.

Then I installed 10.10 and ran ‘migrate:up’ once more. It prints out:

[17:08:04.860] INFO: Skipping CLI extensions initialization due to outstanding migrations.[17:08:04.870] INFO: Running migrations…[17:08:04.906] INFO: Applying Marketplace…[17:08:04.959] WARN: Some tables and columns do not match your database’s default collation (utf8mb4_general_ci):- Table “directus_collections”: “utf8mb4_general_ci”- Column “translations”: “utf8mb4_bin”- Column “item_duplication_fields”: “utf8mb4_bin”- Table “directus_fields”: “utf8mb4_general_ci”- Column “options”: “utf8mb4_bin”- Column “display_options”: “utf8mb4_bin”- Column “translations”: “utf8mb4_bin”- Column “conditions”: “utf8mb4_bin”- Column “validation”: “utf8mb4_bin”- Table “directus_files”: “utf8mb4_general_ci”- Column “metadata”: “utf8mb4_bin”- Table “directus_flows”: “utf8mb4_general_ci”- Column “options”: “utf8mb4_bin”- Table “directus_operations”: “utf8mb4_general_ci”- Column “options”: “utf8mb4_bin”- Table “directus_panels”: “utf8mb4_general_ci”- Column “options”: “utf8mb4_bin”- Table “directus_permissions”: “utf8mb4_general_ci”- Column “permissions”: “utf8mb4_bin”- Column “validation”: “utf8mb4_bin”- Column “presets”: “utf8mb4_bin”- Table “directus_presets”: “utf8mb4_general_ci”- Column “layout_query”: “utf8mb4_bin”- Column “layout_options”: “utf8mb4_bin”- Column “filter”: “utf8mb4_bin”- Table “directus_revisions”: “utf8mb4_general_ci”- Column “data”: “utf8mb4_bin”- Column “delta”: “utf8mb4_bin”- Table “directus_settings”: “utf8mb4_general_ci”- Column “storage_asset_presets”: “utf8mb4_bin”- Column “basemaps”: “utf8mb4_bin”- Column “module_bar”: “utf8mb4_bin”- Column “custom_aspect_ratios”: “utf8mb4_bin”- Column “theme_light_overrides”: “utf8mb4_bin”- Column “theme_dark_overrides”: “utf8mb4_bin”- Table “directus_users”: “utf8mb4_general_ci”- Column “tags”: “utf8mb4_bin”- Column “auth_data”: “utf8mb4_bin”- Column “theme_light_overrides”: “utf8mb4_bin”- Column “theme_dark_overrides”: “utf8mb4_bin”- Table “directus_webhooks”: “utf8mb4_general_ci”- Column “headers”: “utf8mb4_bin”- Table “familyphotos”: “utf8mb4_general_ci”- Column “People”: “utf8mb4_bin”- Column “Locations”: “utf8mb4_bin”- Table “publishers”: “utf8mb4_unicode_ci”- Column “name”: “utf8mb4_unicode_ci”- Column “slug”: “utf8mb4_unicode_ci”
[17:08:07.141] ERROR: Cannot read properties of undefined (reading ‘join’)err: {“type”: “TypeError”,“message”: “Cannot read properties of undefined (reading ‘join’)”,“stack”:TypeError: Cannot read properties of undefined (reading ‘join’)at Function. (file:///usr/lib/node_modules/directus/node_modules//api/dist/database/index.js:132:86)at Function.emit (node:events:524:28)at Client_MySQL. (/usr/lib/node_modules/directus/node_modules/knex/lib/knex-builder/make-knex.js:307:10)at Client_MySQL.emit (node:events:524:28)at /usr/lib/node_modules/directus/node_modules/knex/lib/execution/runner.js:165:21at process.processTicksAndRejections (node:internal/process/task_queues:95:5)at async Runner.queryArray (/usr/lib/node_modules/directus/node_modules/knex/lib/execution/runner.js:287:20)at async Runner.ensureConnection (/usr/lib/node_modules/directus/node_modules/knex/lib/execution/runner.js:318:14)at async Runner.run (/usr/lib/node_modules/directus/node_modules/knex/lib/execution/runner.js:30:19)at async up (file:///usr/lib/node_modules/directus/node_modules//api/dist/database/migrations/20240204A-marketplace.js:53:5)}

And Directus then starts, but throws an “Unknown Error” and doesn’t show the login page.

I do actually need the Directus-provided metadata in my current database, like the edit history, the users, and so on. I don’t even know how I would rebuild a bunch of that stuff if I simply deleted the Directus tables in my DB and installed fresh. But either I’ve waited too long to upgrade or there’s s bug somewhere in the migration code, or I don’t understand how to properly run the migration.

I do love Directus, but the endless errors and issues I tend to encounter every time I install or upgrade it has caused me to develop an “if it ain’t broke don’t fix it’ attitude and that’s why I was still running 10.9.0. But I think I’d like to get current if it’s possible, but now I don’t know how.

Can anyone help?