mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
Bumping to Knex 0.6.12, Bookshelf 0.7.1
This commit is contained in:
parent
d9c45b4967
commit
f87e0d364d
5 changed files with 12 additions and 12 deletions
|
@ -33,7 +33,7 @@ exporter = function () {
|
|||
});
|
||||
|
||||
return when.resolve(exportData);
|
||||
}, function (err) {
|
||||
}).catch(function (err) {
|
||||
console.log('Error exporting data: ' + err);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -118,8 +118,8 @@ var db = {
|
|||
},
|
||||
posts_tags: {
|
||||
id: {type: 'increments', nullable: false, primary: true},
|
||||
post_id: {type: 'integer', nullable: false, unsigned: true, references: 'id', inTable: 'posts'},
|
||||
tag_id: {type: 'integer', nullable: false, unsigned: true, references: 'id', inTable: 'tags'}
|
||||
post_id: {type: 'integer', nullable: false, unsigned: true, references: 'posts.id'},
|
||||
tag_id: {type: 'integer', nullable: false, unsigned: true, references: 'tags.id'}
|
||||
},
|
||||
apps: {
|
||||
id: {type: 'increments', nullable: false, primary: true},
|
||||
|
@ -138,7 +138,7 @@ var db = {
|
|||
uuid: {type: 'string', maxlength: 36, nullable: false},
|
||||
key: {type: 'string', maxlength: 150, nullable: false, unique: true},
|
||||
value: {type: 'text', maxlength: 65535, nullable: true},
|
||||
app_id: {type: 'integer', nullable: false, unsigned: true, references: 'id', inTable: 'apps'},
|
||||
app_id: {type: 'integer', nullable: false, unsigned: true, references: 'apps.id'},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
created_by: {type: 'integer', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true},
|
||||
|
@ -150,7 +150,7 @@ var db = {
|
|||
key: {type: 'string', maxlength: 150, nullable: false},
|
||||
value: {type: 'text', maxlength: 65535, nullable: true},
|
||||
type: {type: 'string', maxlength: 150, nullable: false, defaultTo: 'html'},
|
||||
app_id: {type: 'integer', nullable: false, unsigned: true, references: 'id', inTable: 'apps'},
|
||||
app_id: {type: 'integer', nullable: false, unsigned: true, references: 'apps.id'},
|
||||
relatable_id: {type: 'integer', nullable: false, unsigned: true},
|
||||
relatable_type: {type: 'string', maxlength: 150, nullable: false, defaultTo: 'posts'},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
|
|
|
@ -32,10 +32,9 @@ function createTable(table) {
|
|||
if (schema[table][key].hasOwnProperty('unsigned') && schema[table][key].unsigned) {
|
||||
column.unsigned();
|
||||
}
|
||||
if (schema[table][key].hasOwnProperty('references') && schema[table][key].hasOwnProperty('inTable')) {
|
||||
if (schema[table][key].hasOwnProperty('references')) {
|
||||
//check if table exists?
|
||||
column.references(schema[table][key].references);
|
||||
column.inTable(schema[table][key].inTable);
|
||||
}
|
||||
if (schema[table][key].hasOwnProperty('defaultTo')) {
|
||||
column.defaultTo(schema[table][key].defaultTo);
|
||||
|
@ -50,7 +49,7 @@ function deleteTable(table) {
|
|||
|
||||
function getTablesFromSqlite3() {
|
||||
return knex.raw("select * from sqlite_master where type = 'table'").then(function (response) {
|
||||
return _.reject(_.pluck(response[0], 'tbl_name'), function (name) {
|
||||
return _.reject(_.pluck(response, 'tbl_name'), function (name) {
|
||||
return name === 'sqlite_sequence';
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
// The models are internal to Ghost, only the API and some internal functions such as migration and import/export
|
||||
// accesses the models directly. All other parts of Ghost, including the blog frontend, admin UI, and apps are only
|
||||
// allowed to access data via the API.
|
||||
var Bookshelf = require('bookshelf'),
|
||||
var bookshelf = require('bookshelf'),
|
||||
knex = require('knex'),
|
||||
when = require('when'),
|
||||
moment = require('moment'),
|
||||
_ = require('lodash'),
|
||||
|
@ -20,7 +21,7 @@ var Bookshelf = require('bookshelf'),
|
|||
|
||||
// ### ghostBookshelf
|
||||
// Initializes a new Bookshelf instance called ghostBookshelf, for reference elsewhere in Ghost.
|
||||
ghostBookshelf = Bookshelf.ghost = Bookshelf.initialize(config().database);
|
||||
ghostBookshelf = bookshelf(knex(config().database));
|
||||
ghostBookshelf.client = config().database.client;
|
||||
|
||||
// ### ghostBookshelf.Model
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"dependencies": {
|
||||
"bcryptjs": "0.7.10",
|
||||
"body-parser": "1.0.2",
|
||||
"bookshelf": "0.6.8",
|
||||
"bookshelf": "0.7.1",
|
||||
"busboy": "0.0.12",
|
||||
"colors": "0.6.2",
|
||||
"compression": "^1.0.2",
|
||||
|
@ -46,7 +46,7 @@
|
|||
"express-hbs": "0.7.10",
|
||||
"express-session": "1.0.4",
|
||||
"fs-extra": "0.8.1",
|
||||
"knex": "0.5.8",
|
||||
"knex": "0.6.12",
|
||||
"lodash": "2.4.1",
|
||||
"moment": "2.4.0",
|
||||
"morgan": "1.0.0",
|
||||
|
|
Loading…
Reference in a new issue