diff options
Diffstat (limited to 'src/models/posts.model.js')
-rw-r--r-- | src/models/posts.model.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/models/posts.model.js b/src/models/posts.model.js new file mode 100644 index 0000000..e46117c --- /dev/null +++ b/src/models/posts.model.js @@ -0,0 +1,28 @@ +// See http://docs.sequelizejs.com/en/latest/docs/models-definition/ +// for more of what you can do here. +const Sequelize = require('sequelize'); +const DataTypes = Sequelize.DataTypes; + +module.exports = function (app) { + const sequelizeClient = app.get('sequelizeClient'); + const posts = sequelizeClient.define('posts', { + text: { + type: DataTypes.STRING, + allowNull: false + } + }, { + hooks: { + beforeCount(options) { + options.raw = true; + } + } + }); + + // eslint-disable-next-line no-unused-vars + posts.associate = function (models) { + // Define associations here + // See http://docs.sequelizejs.com/en/latest/docs/associations/ + }; + + return posts; +}; |