@directus/schema
Advanced tools
Comparing version 9.0.0-rc.69 to 9.0.0-rc.70
@@ -98,3 +98,3 @@ "use strict"; | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.knex.raw("\n\t\t\tSELECT\n\t\t\t\tc.TABLE_NAME as table_name,\n\t\t\t\tc.COLUMN_NAME as column_name,\n\t\t\t\tc.COLUMN_DEFAULT as default_value,\n\t\t\t\tc.IS_NULLABLE as is_nullable,\n\t\t\t\tc.DATA_TYPE as data_type,\n\t\t\t\tpk.PK_SET as column_key,\n\t\t\t\tCOLUMNPROPERTY(OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME), c.COLUMN_NAME, 'IsIdentity') as is_identity\n\t\t\tFROM\n\t\t\t\t[" + this.knex.client.database() + "].INFORMATION_SCHEMA.COLUMNS as c\n\t\t\tLEFT JOIN (\n\t\t\t\tSELECT\n\t\t\t\t\tPK_SET = CASE WHEN CONSTRAINT_NAME LIKE '%pk%' THEN 'PRIMARY' ELSE NULL END,\n\t\t\t\t\tTABLE_NAME,\n\t\t\t\t\tCONSTRAINT_CATALOG,\n\t\t\t\t\tCOLUMN_NAME\n\t\t\t\tFROM [" + this.knex.client.database() + "].INFORMATION_SCHEMA.KEY_COLUMN_USAGE\n\t\t\t) as pk\n\t\t\tON [c].[TABLE_NAME] = [pk].[TABLE_NAME]\n\t\t\tAND [c].[TABLE_CATALOG] = [pk].[CONSTRAINT_CATALOG]\n\t\t\tAND [c].[COLUMN_NAME] = [pk].[COLUMN_NAME]\n\t\t\t")]; | ||
case 0: return [4 /*yield*/, this.knex.raw("\n\t\t\tSELECT\n\t\t\t\tc.TABLE_NAME as table_name,\n\t\t\t\tc.COLUMN_NAME as column_name,\n\t\t\t\tc.COLUMN_DEFAULT as default_value,\n\t\t\t\tc.IS_NULLABLE as is_nullable,\n\t\t\t\tc.DATA_TYPE as data_type,\n\t\t\t\tpk.PK_SET as column_key,\n\t\t\t\tCOLUMNPROPERTY(OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME), c.COLUMN_NAME, 'IsIdentity') as is_identity\n\t\t\tFROM\n\t\t\t\t[" + this.knex.client.database() + "].INFORMATION_SCHEMA.COLUMNS as c\n\t\t\tLEFT JOIN (\n\t\t\t\tSELECT\n\t\t\t\t\tPK_SET = CASE WHEN CONSTRAINT_NAME LIKE '%pk%' THEN 'PRIMARY' ELSE NULL END,\n\t\t\t\t\tTABLE_NAME,\n\t\t\t\t\tCONSTRAINT_CATALOG,\n\t\t\t\t\tCOLUMN_NAME\n\t\t\t\tFROM [" + this.knex.client.database() + "].INFORMATION_SCHEMA.KEY_COLUMN_USAGE\n\t\t\t) as pk\n\t\t\tON [c].[TABLE_NAME] = [pk].[TABLE_NAME]\n\t\t\tAND [c].[TABLE_CATALOG] = [pk].[CONSTRAINT_CATALOG]\n\t\t\tAND [c].[COLUMN_NAME] = [pk].[COLUMN_NAME]\n\t\t\tINNER JOIN\n\t\t\t\t[" + this.knex.client.database() + "].INFORMATION_SCHEMA.TABLES as t\n\t\t\tON [c].[TABLE_NAME] = [t].[TABLE_NAME]\n\t\t\tAND [c].[TABLE_CATALOG] = [t].[TABLE_CATALOG]\n\t\t\tAND [t].TABLE_TYPE = 'BASE TABLE'\n\t\t\t")]; | ||
case 1: | ||
@@ -101,0 +101,0 @@ columns = _b.sent(); |
@@ -96,3 +96,3 @@ "use strict"; | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.knex.raw("\n\t\t\tSELECT\n\t\t\t\tC.TABLE_NAME as table_name,\n\t\t\t\tC.COLUMN_NAME as column_name,\n\t\t\t\tC.COLUMN_DEFAULT as default_value,\n\t\t\t\tC.IS_NULLABLE as is_nullable,\n\t\t\t\tC.DATA_TYPE as data_type,\n\t\t\t\tC.COLUMN_KEY as column_key,\n\t\t\t\tC.EXTRA as extra\n\t\t\tFROM\n\t\t\t\tINFORMATION_SCHEMA.COLUMNS AS C\n\t\t\tLEFT JOIN\n\t\t\t\tINFORMATION_SCHEMA.TABLES AS T ON C.TABLE_NAME = T.TABLE_NAME\n\t\t\tWHERE\n\t\t\t\tT.TABLE_TYPE = 'BASE TABLE' AND\n\t\t\t\tC.TABLE_SCHEMA = ?;\n\t\t\t", [this.knex.client.database()])]; | ||
case 0: return [4 /*yield*/, this.knex.raw("\n\t\t\tSELECT\n\t\t\t\tC.TABLE_NAME as table_name,\n\t\t\t\tC.COLUMN_NAME as column_name,\n\t\t\t\tC.COLUMN_DEFAULT as default_value,\n\t\t\t\tC.IS_NULLABLE as is_nullable,\n\t\t\t\tC.COLUMN_TYPE as data_type,\n\t\t\t\tC.COLUMN_KEY as column_key,\n\t\t\t\tC.EXTRA as extra\n\t\t\tFROM\n\t\t\t\tINFORMATION_SCHEMA.COLUMNS AS C\n\t\t\tLEFT JOIN\n\t\t\t\tINFORMATION_SCHEMA.TABLES AS T ON C.TABLE_NAME = T.TABLE_NAME\n\t\t\tWHERE\n\t\t\t\tT.TABLE_TYPE = 'BASE TABLE' AND\n\t\t\t\tC.TABLE_SCHEMA = ?;\n\t\t\t", [this.knex.client.database()])]; | ||
case 1: | ||
@@ -110,3 +110,3 @@ columns = _c.sent(); | ||
} | ||
overview[column.table_name].columns[column.column_name] = __assign(__assign({}, column), { default_value: column.extra === 'auto_increment' ? 'AUTO_INCREMENT' : mysql_1.parseDefaultValue(column.default_value), is_nullable: column.is_nullable === 'YES' }); | ||
overview[column.table_name].columns[column.column_name] = __assign(__assign({}, column), { default_value: column.extra === 'auto_increment' ? 'AUTO_INCREMENT' : mysql_1.parseDefaultValue(column.default_value), is_nullable: column.is_nullable === 'YES', data_type: column.data_type.split('(')[0] }); | ||
}; | ||
@@ -113,0 +113,0 @@ for (_i = 0, _b = columns[0]; _i < _b.length; _i++) { |
{ | ||
"name": "@directus/schema", | ||
"version": "9.0.0-rc.69", | ||
"version": "9.0.0-rc.70", | ||
"description": "Utility for extracting information about existing DB schema", | ||
@@ -43,3 +43,3 @@ "main": "dist/index.js", | ||
"npm-watch": "^0.9.0", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.3.2" | ||
}, | ||
@@ -50,3 +50,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "1d7e977eb8650127b2f5c83d529d0b6f188e7d6c" | ||
"gitHead": "a6a354a0ae336ae77a430dfaab7224a68dbfd14e" | ||
} |
@@ -32,2 +32,7 @@ import KnexMSSQL, { parseDefaultValue } from 'knex-schema-inspector/dist/dialects/mssql'; | ||
AND [c].[COLUMN_NAME] = [pk].[COLUMN_NAME] | ||
INNER JOIN | ||
[${this.knex.client.database()}].INFORMATION_SCHEMA.TABLES as t | ||
ON [c].[TABLE_NAME] = [t].[TABLE_NAME] | ||
AND [c].[TABLE_CATALOG] = [t].[TABLE_CATALOG] | ||
AND [t].TABLE_TYPE = 'BASE TABLE' | ||
` | ||
@@ -34,0 +39,0 @@ ); |
@@ -14,3 +14,3 @@ import KnexMySQL, { parseDefaultValue } from 'knex-schema-inspector/dist/dialects/mysql'; | ||
C.IS_NULLABLE as is_nullable, | ||
C.DATA_TYPE as data_type, | ||
C.COLUMN_TYPE as data_type, | ||
C.COLUMN_KEY as column_key, | ||
@@ -45,2 +45,3 @@ C.EXTRA as extra | ||
is_nullable: column.is_nullable === 'YES', | ||
data_type: column.data_type.split('(')[0], | ||
}; | ||
@@ -47,0 +48,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95424
1100