mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix DB_CLIENT expected before project initialized (#23256)
This commit is contained in:
5
.changeset/tender-dragons-teach.md
Normal file
5
.changeset/tender-dragons-teach.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/api': patch
|
||||
---
|
||||
|
||||
Fixed `"DB_CLIENT" Environment Variable is missing.` appearing during `directus init`
|
||||
@@ -191,12 +191,12 @@ export function getDatabase(): Knex {
|
||||
return database;
|
||||
}
|
||||
|
||||
export function getSchemaInspector(): SchemaInspector {
|
||||
export function getSchemaInspector(database?: Knex): SchemaInspector {
|
||||
if (inspector) {
|
||||
return inspector;
|
||||
}
|
||||
|
||||
const database = getDatabase();
|
||||
database ??= getDatabase();
|
||||
|
||||
inspector = createInspector(database);
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ export async function up(knex: Knex) {
|
||||
});
|
||||
|
||||
try {
|
||||
const inspector = await getSchemaInspector();
|
||||
const inspector = await getSchemaInspector(knex);
|
||||
const foreignKeys = await inspector.foreignKeys('directus_permissions');
|
||||
|
||||
const foreignConstraint =
|
||||
|
||||
Reference in New Issue
Block a user