Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict'
  2. // See http://docs.sequelizejs.com/en/latest/docs/models-definition/
  3. // for more of what you can do here.
  4. const Sequelize = require('sequelize');
  5.  
  6. module.exports = function (app) {
  7.   const sequelizeClient = app.get('sequelizeClient');
  8.   const users = sequelizeClient.define('users', {
  9.     username: {
  10.       type: Sequelize.STRING,
  11.       allowNull: true,
  12.       unique: true
  13.     },
  14.     email: {
  15.       type: Sequelize.STRING,
  16.       allowNull: true,
  17.       unique: true
  18.     },
  19.     password: {
  20.       type: Sequelize.STRING,
  21.       allowNull: true
  22.     },
  23.   });
  24.  
  25.   users.associate = (models) => {
  26.     users.hasMany(models.auctions, { foreignKey: 'seller_id' })
  27.   }
  28.  
  29.   return users;
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement