nextjs-cms 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,10 +7,10 @@ import chalk from 'chalk';
|
|
|
7
7
|
*/
|
|
8
8
|
export class MysqlTableChecker extends DbTableChecker {
|
|
9
9
|
static async getColumns(tableName) {
|
|
10
|
-
const statement = sql `
|
|
11
|
-
SELECT COLUMN_NAME
|
|
12
|
-
FROM information_schema.COLUMNS c
|
|
13
|
-
inner join information_schema.TABLES t ON t.TABLE_NAME = c.TABLE_NAME
|
|
10
|
+
const statement = sql `
|
|
11
|
+
SELECT COLUMN_NAME
|
|
12
|
+
FROM information_schema.COLUMNS c
|
|
13
|
+
inner join information_schema.TABLES t ON t.TABLE_NAME = c.TABLE_NAME
|
|
14
14
|
WHERE t.TABLE_NAME = ${tableName}`;
|
|
15
15
|
const _cols = [];
|
|
16
16
|
const _res = await db.execute(statement);
|
|
@@ -67,10 +67,10 @@ export class MysqlTableChecker extends DbTableChecker {
|
|
|
67
67
|
fullTextKeys.push({ name: key, columns: _fullTextKeyMap[key] });
|
|
68
68
|
}
|
|
69
69
|
// Foreign keys should be retrieved from information_schema
|
|
70
|
-
const [foreignKeys] = await db.execute(sql `
|
|
71
|
-
SELECT COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
|
|
72
|
-
FROM information_schema.KEY_COLUMN_USAGE
|
|
73
|
-
WHERE TABLE_NAME = ${table} AND CONSTRAINT_NAME != 'PRIMARY' AND REFERENCED_TABLE_NAME IS NOT NULL;
|
|
70
|
+
const [foreignKeys] = await db.execute(sql `
|
|
71
|
+
SELECT COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
|
|
72
|
+
FROM information_schema.KEY_COLUMN_USAGE
|
|
73
|
+
WHERE TABLE_NAME = ${table} AND CONSTRAINT_NAME != 'PRIMARY' AND REFERENCED_TABLE_NAME IS NOT NULL;
|
|
74
74
|
`);
|
|
75
75
|
return { primaryKeys, uniqueKeys, indexKeys, foreignKeys, fullTextKeys };
|
|
76
76
|
}
|