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

feat: DDL query in table settings for MySQL and PostgreSQL, closes #581

This commit is contained in:
2023-05-25 18:51:56 +02:00
parent 56698725cb
commit f454b4bb1c
14 changed files with 285 additions and 6 deletions

View File

@@ -701,6 +701,17 @@ export class MySQLClient extends AntaresCore {
});
}
async getTableDll ({ schema, table }: { schema: string; table: string }) {
const { rows } = await this.raw<antares.QueryResult<{
'Create Table'?: string;
Table: string;
}>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
if (rows.length)
return rows[0]['Create Table'];
else return '';
}
async getKeyUsage ({ schema, table }: { schema: string; table: string }) {
interface KeyResult {
TABLE_SCHEMA: string;