diff --git a/src/drivers/common/MySQLCommonInterface.ts b/src/drivers/common/MySQLCommonInterface.ts index dc14ab5..9d9ec21 100644 --- a/src/drivers/common/MySQLCommonInterface.ts +++ b/src/drivers/common/MySQLCommonInterface.ts @@ -259,7 +259,10 @@ export default class MySQLCommonInterface extends SQLCommonInterface { ); } - async getTableSchema(table: string): Promise { + async getTableSchema( + database: string, + table: string + ): Promise { const response = await this.runner.execute( [ { @@ -279,7 +282,7 @@ export default class MySQLCommonInterface extends SQLCommonInterface { 'COLUMN_TYPE' ) .where({ - table_schema: this.currentDatabaseName, + table_schema: database, table_name: table, }) .toRawSQL(), diff --git a/src/drivers/common/SQLCommonInterface.ts b/src/drivers/common/SQLCommonInterface.ts index 59c343e..a28b5b5 100644 --- a/src/drivers/common/SQLCommonInterface.ts +++ b/src/drivers/common/SQLCommonInterface.ts @@ -2,6 +2,9 @@ import { DatabaseSchemas, TableDefinitionSchema } from 'types/SqlSchema'; export default abstract class SQLCommonInterface { abstract getSchema(): Promise; - abstract getTableSchema(table: string): Promise; + abstract getTableSchema( + database: string, + table: string + ): Promise; abstract switchDatabase(database: string): Promise; } diff --git a/src/renderer/screens/DatabaseScreen/SqlTableSchemaTab/index.tsx b/src/renderer/screens/DatabaseScreen/SqlTableSchemaTab/index.tsx index c1ee372..24ee68d 100644 --- a/src/renderer/screens/DatabaseScreen/SqlTableSchemaTab/index.tsx +++ b/src/renderer/screens/DatabaseScreen/SqlTableSchemaTab/index.tsx @@ -24,8 +24,8 @@ export default function SqlTableSchemaTab({ ); useEffect(() => { - common.getTableSchema(table).then(setDefinition).catch(); - }, [common]); + common.getTableSchema(database, table).then(setDefinition).catch(); + }, [database, common]); useEffect(() => { setTabData(tabKey, { type: 'table-schema', database, table });