1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix(MySQL): handle absence of CHECK_CONSTRAINTS table, fixes #981

This commit is contained in:
2025-04-28 11:03:18 +02:00
parent c966cc4266
commit 86f50521d0
2 changed files with 75 additions and 28 deletions

View File

@@ -696,7 +696,12 @@ export class MySQLClient extends BaseClient {
return rows.length ? rows[0].count : 0;
}
async getTableChecks ({ schema, table }: { schema: string; table: string }): Promise<antares.TableCheck[]> {
async getTableChecks ({ schema, table }: { schema: string; table: string }): Promise<antares.TableCheck[] | false> {
const { rows: checkTableExists } = await this.raw('SELECT table_name FROM information_schema.tables WHERE table_schema = "information_schema" AND table_name = "CHECK_CONSTRAINTS"');
if (!checkTableExists.length)// check if CHECK_CONSTRAINTS table exists
return false;
const { rows } = await this.raw(`
SELECT
CONSTRAINT_NAME as name,