Ignore default DB_FILENAME option when using MySQL/MariaDB (#22970)

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
Protogon
2024-07-11 18:23:59 +01:00
committed by GitHub
parent 4a5e0de18c
commit d428670e4e
3 changed files with 10 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@directus/api": patch
---
Ensured the default `DB_FILENAME` option from the Docker Image is not applied when using MySQL/MariaDB, fixing a corresponding warning

View File

@@ -1,6 +1,7 @@
import { useEnv } from '@directus/env';
import type { SchemaInspector } from '@directus/schema';
import { createInspector } from '@directus/schema';
import { isObject } from '@directus/utils';
import fse from 'fs-extra';
import type { Knex } from 'knex';
import knex from 'knex';
@@ -136,6 +137,9 @@ export function getDatabase(): Knex {
}
if (client === 'mysql') {
// Remove the conflicting `filename` option, defined by default in the Docker Image
if (isObject(knexConfig.connection)) delete knexConfig.connection['filename'];
Object.assign(knexConfig, { client: 'mysql2' });
poolConfig.afterCreate = async (conn: any, callback: any) => {

View File

@@ -141,3 +141,4 @@
- Dominic-Preap
- brandondrew
- alantiller
- cliqer