From f82be2a207c5e03cb06252b643252f2517adaa50 Mon Sep 17 00:00:00 2001 From: Chareice Date: Tue, 14 Feb 2023 21:35:44 +0800 Subject: [PATCH] chore: show constraints query path --- packages/core/database/src/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/database/src/utils.ts b/packages/core/database/src/utils.ts index 6fbbcc8c7..bbe041c30 100644 --- a/packages/core/database/src/utils.ts +++ b/packages/core/database/src/utils.ts @@ -89,7 +89,13 @@ export function patchSequelizeQueryInterface(db: Database) { //@ts-ignore const queryGenerator = db.sequelize.dialect.queryGenerator; + const originalShowConstraintsQuery = queryGenerator.showConstraintsQuery; + queryGenerator.showConstraintsQuery = (tableName, constraintName) => { + if (!constraintName) { + return originalShowConstraintsQuery.call(queryGenerator, tableName, constraintName); + } + const lines = [ 'SELECT constraint_catalog AS "constraintCatalog",', 'constraint_schema AS "constraintSchema",',