Merge pull request #1573 from halfdan/1333-pg

Update Knex/Bookshelf, Fix Postgres Build
This commit is contained in:
Hannah Wolfe 2013-11-27 02:26:17 -08:00
commit 5601594d3e
5 changed files with 15 additions and 9 deletions

View File

@ -24,9 +24,13 @@ var config = require('./server/config'),
init;
// If we're in development mode, require "when/console/monitor"
// for help in seeing swallowed promise errors.
// for help in seeing swallowed promise errors, and log any
// stderr messages from bluebird promises.
if (process.env.NODE_ENV === 'development') {
require('when/monitor/console');
process.stderr.on('data', function (msg) {
console.log(msg);
});
}
// Sets up the express server instance.

View File

@ -142,10 +142,12 @@ function getTablesFromSqlite3() {
});
}
// Basic suppport for PgSQL
// Attention: not officially tested/supported
function getTablesFromPgSQL() {
return knex.raw("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'");
return knex.raw("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'").then(function (response) {
return _.flatten(_.map(response[0], function (entry) {
return _.values(entry);
}));
});
}
function getTablesFromMySQL() {

View File

@ -280,7 +280,7 @@ Post = ghostBookshelf.Model.extend({
qb.where(opts.where);
}
return qb.count(_.result(collection, 'idAttribute')).then(function (resp) {
return qb.count(_.result(collection, 'idAttribute') + ' as aggregate').then(function (resp) {
var totalPosts = parseInt(resp[0].aggregate, 10),
data = {
posts: collection.toJSON(),

View File

@ -209,7 +209,7 @@ describe("Import", function () {
done();
});
}).then(null, done);
});
it("doesn't import invalid settings data from 001", function (done) {
@ -258,7 +258,7 @@ describe("Import", function () {
done();
});
}).then(null, done);
});
});

View File

@ -33,14 +33,14 @@
"engineStrict": true,
"dependencies": {
"bcryptjs": "0.7.10",
"bookshelf": "0.5.7",
"bookshelf": "0.6.1",
"colors": "0.6.2",
"connect-slashes": "0.0.11",
"downsize": "0.0.3",
"express": "3.4.4",
"express-hbs": "0.5.1",
"fs-extra": "0.8.1",
"knex": "0.4.13",
"knex": "0.5.0",
"moment": "2.4.0",
"node-polyglot": "0.3.0",
"node-uuid": "1.4.1",