0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/core/shared/models/index.js

29 lines
No EOL
983 B
JavaScript

/*global require, module */
(function () {
"use strict";
var GhostBookshelf = require('./base'),
errors = require('../errorHandling'),
knex = GhostBookshelf.Knex;
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();
}, errors.logAndThrowError);
}, errors.logAndThrowError).then(function () {
console.log('models loaded');
}, errors.logAndThrowError);
}
};
}());