Socket
Socket
Sign inDemoInstall

knex-schema-inspector

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex-schema-inspector - npm Package Compare versions

Comparing version 1.5.4 to 1.5.5

12

dist/dialects/mysql.js

@@ -53,6 +53,16 @@ "use strict";

var _a, _b;
var dataType = rawColumn.COLUMN_TYPE.split('(')[0];
/**
* Smooth out a difference between MySQL and MariaDB. MySQL reports the column type as `int
* unsigned`, while MariaDB reports it as `int(11) unsigned`. This would cause the `unsigned` part
* of the type to be dropped in the columnInfo retrieval for MariaDB powered databases.
*/
if (rawColumn.COLUMN_TYPE.includes('unsigned') &&
dataType.includes('unsigned') === false) {
dataType += ' unsigned';
}
return {
name: rawColumn.COLUMN_NAME,
table: rawColumn.TABLE_NAME,
data_type: rawColumn.COLUMN_TYPE.split('(')[0],
data_type: dataType,
default_value: (_a = parseDefaultValue(rawColumn.COLUMN_DEFAULT)) !== null && _a !== void 0 ? _a : parseDefaultValue(rawColumn.GENERATION_EXPRESSION || null),

@@ -59,0 +69,0 @@ max_length: rawColumn.CHARACTER_MAXIMUM_LENGTH,

@@ -37,6 +37,20 @@ import { Knex } from 'knex';

export function rawColumnToColumn(rawColumn: RawColumn): Column {
let dataType = rawColumn.COLUMN_TYPE.split('(')[0];
/**
* Smooth out a difference between MySQL and MariaDB. MySQL reports the column type as `int
* unsigned`, while MariaDB reports it as `int(11) unsigned`. This would cause the `unsigned` part
* of the type to be dropped in the columnInfo retrieval for MariaDB powered databases.
*/
if (
rawColumn.COLUMN_TYPE.includes('unsigned') &&
dataType.includes('unsigned') === false
) {
dataType += ' unsigned';
}
return {
name: rawColumn.COLUMN_NAME,
table: rawColumn.TABLE_NAME,
data_type: rawColumn.COLUMN_TYPE.split('(')[0],
data_type: dataType,
default_value:

@@ -43,0 +57,0 @@ parseDefaultValue(rawColumn.COLUMN_DEFAULT) ??

2

package.json
{
"name": "knex-schema-inspector",
"version": "1.5.4",
"version": "1.5.5",
"description": "Utility for extracting information about existing DB schema",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc