@directus/schema
Advanced tools
Comparing version 9.0.0-rc.48 to 9.0.0-rc.49
@@ -82,3 +82,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\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\t")]; | ||
case 1: | ||
@@ -96,3 +96,3 @@ columns = _b.sent(); | ||
} | ||
overview[column.table_name].columns[column.column_name] = __assign(__assign({}, column), { default_value: this_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.is_identity ? 'AUTO_INCREMENT' : this_1.parseDefaultValue(column.default_value), is_nullable: column.is_nullable === 'YES' }); | ||
}; | ||
@@ -99,0 +99,0 @@ this_1 = this; |
{ | ||
"name": "@directus/schema", | ||
"version": "9.0.0-rc.48", | ||
"version": "9.0.0-rc.49", | ||
"description": "Utility for extracting information about existing DB schema", | ||
@@ -50,3 +50,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "3803333025f315057345c33e94e853017a935a5a" | ||
"gitHead": "b17f3e0911f2e8b9a393df351b30ccab1a655afb" | ||
} |
@@ -17,3 +17,4 @@ import KnexMSSQL from 'knex-schema-inspector/dist/dialects/mssql'; | ||
c.DATA_TYPE as data_type, | ||
pk.PK_SET as column_key | ||
pk.PK_SET as column_key, | ||
COLUMNPROPERTY(OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME), c.COLUMN_NAME, 'IsIdentity') as is_identity | ||
FROM | ||
@@ -49,3 +50,3 @@ [${this.knex.client.database()}].INFORMATION_SCHEMA.COLUMNS as c | ||
...column, | ||
default_value: this.parseDefaultValue(column.default_value), | ||
default_value: column.is_identity ? 'AUTO_INCREMENT' : this.parseDefaultValue(column.default_value), | ||
is_nullable: column.is_nullable === 'YES', | ||
@@ -52,0 +53,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
112971
1875