Ghost - knex-migration failed from 4.9.4 to 4.32.3

Hello,

I am trying to do a ghost migration from the version 4.9.4 to the 4.32.3 version. However, I get the following error :

[2022-01-18 13:07:49] ERROR alter table `oauth` add constraint `oauth_user_id_foreign` foreign key (`user_id`) references `users` (`id`) - ER_CANT_CREATE_TABLE: Can't create table `x_blog_ghost`.`oauth` (errno: 150 "Foreign key constraint is incorrectly formed")

alter table `oauth` add constraint `oauth_user_id_foreign` foreign key (`user_id`) references `users` (`id`) - ER_CANT_CREATE_TABLE: Can't create table `x_blog_ghost`.`oauth` (errno: 150 "Foreign key constraint is incorrectly formed")

{"config":{"transaction":false},"name":"01-add-oauth-user-data.js"}
"Error occurred while executing the following migration: 01-add-oauth-user-data.js"

Error ID:
    300

Error Code: 
    ER_CANT_CREATE_TABLE

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

MigrationScriptError: alter table `oauth` add constraint `oauth_user_id_foreign` foreign key (`user_id`) references `users` (`id`) - ER_CANT_CREATE_TABLE: Can't create table `x_blog_ghost`.`oauth` (errno: 150 "Foreign key constraint is incorrectly formed")
    at DatabaseStateManager.makeReady (/opt/bitnami/ghost/versions/4.32.3/core/server/data/db/state-manager.js:95:32)
    at MigrationScriptError.KnexMigrateError (/opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/lib/errors.js:7:26)
    at new MigrationScriptError (/opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/lib/errors.js:25:26)
    at /opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/lib/index.js:1032:19
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Error: ER_CANT_CREATE_TABLE: Can't create table `x_blog_ghost`.`oauth` (errno: 150 "Foreign key constraint is incorrectly formed")
    at Query.Sequence._packetToError (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Query.ErrorPacket (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
    at Protocol._parsePacket (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
    --------------------
    at Protocol._enqueue (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Connection.query (/opt/bitnami/ghost/versions/4.32.3/node_modules/mysql/lib/Connection.js:198:25)
    at /opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/node_modules/knex/lib/dialects/mysql/index.js:134:18
    at new Promise (<anonymous>)
    at Client_MySQL._query (/opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/node_modules/knex/lib/dialects/mysql/index.js:128:12)
    at Client_MySQL.query (/opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/node_modules/knex/lib/client.js:168:17)
    at Runner.query (/opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/node_modules/knex/lib/runner.js:151:36)
    at Runner.queryArray (/opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/node_modules/knex/lib/runner.js:248:31)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /opt/bitnami/ghost/versions/4.32.3/node_modules/knex-migrator/node_modules/knex/lib/runner.js:277:18
    at async Object.up (/opt/bitnami/ghost/versions/4.32.3/core/server/data/migrations/utils.js:257:13)

Kubernetes version : 1.20

Mariadb version : 10.5.11

Here are the contents of the 01-add-oauth-user-data.js file :

const {addTable} = require('../../utils');

module.exports = addTable('oauth', {
    id: {type: 'string', maxlength: 24, nullable: false, primary: true},
    provider: {type: 'string', maxlength: 50, nullable: false},
    provider_id: {type: 'string', maxlength: 191, nullable: false},
    access_token: {type: 'text', maxlength: 65535, nullable: true},
    refresh_token: {type: 'text', maxlength: 2000, nullable: true},
    created_at: {type: 'dateTime', nullable: false},
    updated_at: {type: 'dateTime', nullable: true},
    user_id: {type: 'string', maxlength: 24, nullable: false, references: 'users.id'}
});

Is it possible to have the associated SQL queries instead of the javascript file?

Steps to Reproduce

Install this environment :

Kubernetes version : 1.20

Mariadb version : 10.5.11

Ghost version : 4.9.4

Try ghost migration from 4.9.4 version to 4.32.3

Ghost Version

4.9.4

Node.js Version

v14.17.3

How did you install Ghost?

Docker

Database type

MariaDB