From 238f8555fa09d498aad7f9680fb8e44ebdd5c58e Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Sat, 14 Mar 2020 01:05:05 +0800 Subject: [PATCH] fix(core): allow merge implicit database bindings --- packages/koishi-core/src/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/koishi-core/src/database.ts b/packages/koishi-core/src/database.ts index e055a27092..d6a80b5874 100644 --- a/packages/koishi-core/src/database.ts +++ b/packages/koishi-core/src/database.ts @@ -232,7 +232,7 @@ class DatabaseManager { injectMethods (sub: S, table: T, methods: any) { const subdatabase = this.database[sub] as AbstractDatabase - if (!this.explicitTables[table] && this.implicitTables[table]) { + if (!this.explicitTables[table] && this.implicitTables[table] && this.implicitTables[table] !== sub) { throw new Error(`database "${this.implicitTables[table]}" and "${sub}" conflict on table "${table}"`) } else if (!this.explicitTables[table] || this.explicitTables[table] === sub) { this.implicitTables[table] = sub