Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@directus/schema

Package Overview
Dependencies
Maintainers
2
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@directus/schema - npm Package Compare versions

Comparing version 9.10.0 to 9.11.0

9

dist/dialects/postgres.js

@@ -82,11 +82,12 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var _b, columnsResult, primaryKeysResult, columns, primaryKeys, geometryColumns, hasPostGIS, result, overview, _i, columns_1, column, _c, primaryKeys_1, _d, table_name, column_name, _e, geometryColumns_1, _f, table_name, column_name, data_type;
var bindings, _b, columnsResult, primaryKeysResult, columns, primaryKeys, geometryColumns, hasPostGIS, result, overview, _i, columns_1, column, _c, primaryKeys_1, _d, table_name, column_name, _e, geometryColumns_1, _f, table_name, column_name, data_type;
return __generator(this, function (_g) {
switch (_g.label) {
case 0:
bindings = this.explodedSchema.map(function () { return '?'; }).join(',');
return [4 /*yield*/, Promise.all([
// Only select columns from BASE TABLEs to exclude views (Postgres views
// cannot have primary keys so they cannot be used)
this.knex.raw("\n SELECT c.table_name\n , c.column_name\n , c.column_default as default_value\n , c.data_type\n\t\t\t \t\t, c.character_maximum_length as max_length\n , c.is_generated = 'ALWAYS' is_generated\n , CASE WHEN c.is_identity = 'YES' THEN true ELSE false END is_identity\n , CASE WHEN c.is_nullable = 'YES' THEN true ELSE false END is_nullable\n FROM\n information_schema.columns c\n LEFT JOIN information_schema.tables t\n ON c.table_name = t.table_name\n WHERE\n t.table_type = 'BASE TABLE'\n AND c.table_schema IN (?);\n ", [this.explodedSchema.join(',')]),
this.knex.raw("\n SELECT relname as table_name\n , pg_attribute.attname as column_name\n FROM pg_index\n , pg_class\n , pg_attribute\n , pg_namespace\n WHERE\n indrelid = pg_class.oid\n AND nspname IN (?)\n AND pg_class.relnamespace = pg_namespace.oid\n AND pg_attribute.attrelid = pg_class.oid\n AND pg_attribute.attnum = ANY (pg_index.indkey)\n AND indisprimary\n AND indnatts = 1\n\t\t\t AND relkind != 'S'\n ", [this.explodedSchema.join(',')]),
this.knex.raw("\n SELECT c.table_name\n , c.column_name\n , c.column_default as default_value\n , c.data_type\n\t\t\t \t\t, c.character_maximum_length as max_length\n , c.is_generated = 'ALWAYS' is_generated\n , CASE WHEN c.is_identity = 'YES' THEN true ELSE false END is_identity\n , CASE WHEN c.is_nullable = 'YES' THEN true ELSE false END is_nullable\n FROM\n information_schema.columns c\n LEFT JOIN information_schema.tables t\n ON c.table_name = t.table_name\n WHERE\n t.table_type = 'BASE TABLE'\n AND c.table_schema IN (".concat(bindings, ");\n "), this.explodedSchema),
this.knex.raw("\n SELECT relname as table_name\n , pg_attribute.attname as column_name\n FROM pg_index\n , pg_class\n , pg_attribute\n , pg_namespace\n WHERE\n indrelid = pg_class.oid\n AND nspname IN (".concat(bindings, ")\n AND pg_class.relnamespace = pg_namespace.oid\n AND pg_attribute.attrelid = pg_class.oid\n AND pg_attribute.attnum = ANY (pg_index.indkey)\n AND indisprimary\n AND indnatts = 1\n\t\t\t AND relkind != 'S'\n "), this.explodedSchema),
])];

@@ -102,3 +103,3 @@ case 1:

if (!hasPostGIS) return [3 /*break*/, 4];
return [4 /*yield*/, this.knex.raw("WITH geometries as (\n\t\t\t\t\tselect * from geometry_columns\n\t\t\t\t\tunion\n\t\t\t\t\tselect * from geography_columns\n\t\t\t\t)\n\t\t\t\tSELECT f_table_name as table_name\n\t\t\t\t\t, f_geometry_column as column_name\n\t\t\t\t\t, type as data_type\n\t\t\t\tFROM geometries g\n\t\t\t\tJOIN information_schema.tables t\n\t\t\t\t\tON g.f_table_name = t.table_name\n\t\t\t\t\tAND t.table_type = 'BASE TABLE'\n\t\t\t\tWHERE f_table_schema in (?)\n\t\t\t\t", [this.explodedSchema.join(',')])];
return [4 /*yield*/, this.knex.raw("WITH geometries as (\n\t\t\t\t\tselect * from geometry_columns\n\t\t\t\t\tunion\n\t\t\t\t\tselect * from geography_columns\n\t\t\t\t)\n\t\t\t\tSELECT f_table_name as table_name\n\t\t\t\t\t, f_geometry_column as column_name\n\t\t\t\t\t, type as data_type\n\t\t\t\tFROM geometries g\n\t\t\t\tJOIN information_schema.tables t\n\t\t\t\t\tON g.f_table_name = t.table_name\n\t\t\t\t\tAND t.table_type = 'BASE TABLE'\n\t\t\t\tWHERE f_table_schema in (".concat(bindings, ")\n\t\t\t\t"), this.explodedSchema)];
case 3:

@@ -105,0 +106,0 @@ result = _g.sent();

{
"name": "@directus/schema",
"version": "9.10.0",
"version": "9.11.0",
"description": "Utility for extracting information about existing DB schema",

@@ -53,3 +53,3 @@ "main": "dist/index.js",

},
"gitHead": "e3a7a7d8879fb7959fb15802734d830001108fbb"
"gitHead": "f52da51925296b6e615ae2f048727a391d3a2122"
}

@@ -25,2 +25,4 @@ import KnexPostgres, { parseDefaultValue } from 'knex-schema-inspector/dist/dialects/postgres';

const bindings = this.explodedSchema.map(() => '?').join(',');
const [columnsResult, primaryKeysResult] = await Promise.all([

@@ -45,5 +47,5 @@ // Only select columns from BASE TABLEs to exclude views (Postgres views

t.table_type = 'BASE TABLE'
AND c.table_schema IN (?);
AND c.table_schema IN (${bindings});
`,
[this.explodedSchema.join(',')]
this.explodedSchema
),

@@ -61,3 +63,3 @@

indrelid = pg_class.oid
AND nspname IN (?)
AND nspname IN (${bindings})
AND pg_class.relnamespace = pg_namespace.oid

@@ -70,3 +72,3 @@ AND pg_attribute.attrelid = pg_class.oid

`,
[this.explodedSchema.join(',')]
this.explodedSchema
),

@@ -99,5 +101,5 @@ ]);

AND t.table_type = 'BASE TABLE'
WHERE f_table_schema in (?)
WHERE f_table_schema in (${bindings})
`,
[this.explodedSchema.join(',')]
this.explodedSchema
);

@@ -104,0 +106,0 @@

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