2013-06-25 15:43:15 +04:00
|
|
|
var GhostBookshelf = require('./base'),
|
|
|
|
errors = require('../errorHandling'),
|
|
|
|
knex = GhostBookshelf.Knex;
|
2013-06-01 18:47:41 +04:00
|
|
|
|
2013-06-25 15:43:15 +04:00
|
|
|
module.exports = {
|
|
|
|
Post: require('./post').Post,
|
|
|
|
User: require('./user').User,
|
|
|
|
Role: require('./role').Role,
|
|
|
|
Permission: require('./permission').Permission,
|
|
|
|
Settings: require('./settings').Settings,
|
|
|
|
init: function () {
|
|
|
|
return knex.Schema.hasTable('posts').then(null, function () {
|
|
|
|
// Simple bootstraping of the data model for now.
|
|
|
|
var migration = require('../data/migration/001');
|
|
|
|
return migration.down().then(function () {
|
|
|
|
return migration.up();
|
2013-06-17 01:36:28 +04:00
|
|
|
}, errors.logAndThrowError);
|
2013-06-25 15:43:15 +04:00
|
|
|
}, errors.logAndThrowError);
|
|
|
|
}
|
|
|
|
};
|