Skip to content

Commit

Permalink
fix: error joining tables with different schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Oct 17, 2022
1 parent d52b7af commit 88408da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/fieldTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const BLOB = [
'TINYBLOB',
'MEDIUMBLOB',
'LONGBLOB',
'LONG_BLOB',
'BYTEA'
];

Expand Down
7 changes: 6 additions & 1 deletion src/main/libs/clients/MySQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,12 @@ export class MySQLClient extends AntaresCore {
.orderBy({ ORDINAL_POSITION: 'ASC' })
.run<TableColumnsResult>();

const { rows: fields } = await this.raw<antares.QueryResult<CreateTableResult>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
let fields: CreateTableResult[] = [];
try {
const { rows } = await this.raw<antares.QueryResult<CreateTableResult>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
fields = rows;
}
catch (_) {}

const remappedFields = fields.map(row => {
if (!row['Create Table']) return false;
Expand Down
1 change: 1 addition & 0 deletions src/renderer/scss/_data-types.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"mediumblob": $blob-color,
"medium_blob": $blob-color,
"longblob": $blob-color,
"long_blob": $blob-color,
"bytea": $blob-color,
"enum": $enum-color,
"set": $enum-color,
Expand Down

0 comments on commit 88408da

Please sign in to comment.