Guest User

Untitled

a guest
Feb 18th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. const Sequelize = require("sequelize");
  2. const db = require("../Connection/dbConnection");
  3. const UserType = require('../models/userTypeModel')
  4.  
  5. const User = db.define("user", {
  6. id: {
  7. type: DataTypes.INTEGER(11),
  8. allowNull: false,
  9. primaryKey: true,
  10. autoIncrement: true
  11. },
  12. userName: {
  13. type: DataTypes.STRING(512),
  14. allowNull: true
  15. },
  16. password: {
  17. type: DataTypes.STRING(512),
  18. allowNull: true
  19. },
  20. userTypeId: {
  21. type: DataTypes.INTEGER(11),
  22. allowNull: true
  23. },
  24. isActive: {
  25. type: DataTypes.INTEGER(1),
  26. allowNull: true,
  27. defaultValue: "1"
  28.  
  29. }}
  30. ,
  31. {
  32. timestamps: false
  33. }
  34.  
  35. );
  36. User.belongsTo(UserType,{as:'UserType',foreignKey:'userTypeId'})
  37.  
  38.  
  39.  
  40. module.exports = User;
Add Comment
Please, Sign In to add comment