2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Fixing pg build.

refs #2499
- Properly reference pg client
- Fix broken sql queries
This commit is contained in:
Fabian Becker 2014-07-31 12:52:57 +00:00
parent a6c205ac53
commit 640f4c2915
2 changed files with 6 additions and 6 deletions

View file

@ -1,10 +1,10 @@
var sqlite3 = require('./sqlite3'),
mysql = require('./mysql'),
pgsql = require('./pgsql');
pg = require('./pg');
module.exports = {
sqlite3: sqlite3,
mysql: mysql,
pgsql: pgsql
};
pg: pg
};

View file

@ -18,7 +18,7 @@ doRawFlattenAndPluck = function doRaw(query, name) {
getTables = function getTables() {
return doRawFlattenAndPluck(
'SELECT table_name FROM information_schema.tables WHERE table_schema = "public"', 'table_name'
'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\'', 'table_name'
);
};
@ -26,13 +26,13 @@ getIndexes = function getIndexes(table) {
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 + '"';
' a.attrelid = t.oid and a.attnum = ANY(ix.indkey) and t.relname = \'' + table + '\'';
return doRawFlattenAndPluck(selectIndexes, 'index_name');
};
getColumns = function getColumns(table) {
var selectIndexes = 'SELECT column_name FROM information_schema.columns WHERE table_name = "' + table + '"';
var selectIndexes = 'SELECT column_name FROM information_schema.columns WHERE table_name = \'' + table + '\'';
return doRawFlattenAndPluck(selectIndexes, 'column_name');
};