From 5da8da1879ca5a4a62edd61866fa7e5e38a2dfd8 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Mon, 22 Jul 2019 12:11:19 +0800 Subject: [PATCH] Deleted unused pg.js module (#10928) no-issue This module was first created (AFAICT) in https://github.com/TryGhost/Ghost/commit/c09c20ad8d780570a28757641000f6a76d32eb38#diff-20a31f345ca2643b2602224678bb8d5b and has since undergone some filename renames and eslint refactors - we don't support PostgreSQL and have no immediate plans to do so. --- core/server/data/schema/clients/pg.js | 45 --------------------------- 1 file changed, 45 deletions(-) delete mode 100644 core/server/data/schema/clients/pg.js diff --git a/core/server/data/schema/clients/pg.js b/core/server/data/schema/clients/pg.js deleted file mode 100644 index b9671f733c..0000000000 --- a/core/server/data/schema/clients/pg.js +++ /dev/null @@ -1,45 +0,0 @@ -var _ = require('lodash'), - db = require('../../../data/db'), - - // private - doRawFlattenAndPluck, - - // public - getTables, - getIndexes, - getColumns; - -doRawFlattenAndPluck = function doRaw(query, name, transaction) { - return (transaction || db.knex).raw(query).then(function (response) { - return _.flatten(_.map(response.rows, name)); - }); -}; - -getTables = function getTables(transaction) { - return doRawFlattenAndPluck( - 'SELECT table_name FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA()', - 'table_name', - transaction - ); -}; - -getIndexes = function getIndexes(table, transaction) { - var selectIndexes = 'SELECT t.relname as table_name, i.relname as index_name, a.attname as column_name' + - ' FROM pg_class t, pg_class i, pg_index ix, pg_attribute a' + - ' WHERE t.oid = ix.indrelid and i.oid = ix.indexrelid and' + - ' a.attrelid = t.oid and a.attnum = ANY(ix.indkey) and t.relname = \'' + table + '\''; - - return doRawFlattenAndPluck(selectIndexes, 'index_name', transaction); -}; - -getColumns = function getColumns(table, transaction) { - var selectIndexes = 'SELECT column_name FROM information_schema.columns WHERE table_name = \'' + table + '\''; - - return doRawFlattenAndPluck(selectIndexes, 'column_name', transaction); -}; - -module.exports = { - getTables: getTables, - getIndexes: getIndexes, - getColumns: getColumns -};