0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05: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'), var sqlite3 = require('./sqlite3'),
mysql = require('./mysql'), mysql = require('./mysql'),
pgsql = require('./pgsql'); pg = require('./pg');
module.exports = { module.exports = {
sqlite3: sqlite3, sqlite3: sqlite3,
mysql: mysql, mysql: mysql,
pgsql: pgsql pg: pg
}; };

View file

@ -18,7 +18,7 @@ doRawFlattenAndPluck = function doRaw(query, name) {
getTables = function getTables() { getTables = function getTables() {
return doRawFlattenAndPluck( 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' + 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' + ' FROM pg_class t, pg_class i, pg_index ix, pg_attribute a' +
' WHERE t.oid = ix.indrelid and i.oid = ix.indexrelid and' + ' 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'); return doRawFlattenAndPluck(selectIndexes, 'index_name');
}; };
getColumns = function getColumns(table) { 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'); return doRawFlattenAndPluck(selectIndexes, 'column_name');
}; };