Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. module.exports = (sequelize, DataTypes) => {
  2. const team = sequelize.define('team', {
  3. id: {
  4. type: DataTypes.INTEGER(10).UNSIGNED,
  5. allowNull: false,
  6. primaryKey: true,
  7. autoIncrement: true,
  8. },
  9. id_team: {
  10. type: DataTypes.STRING,
  11. allowNull: false,
  12. },
  13. name: {
  14. type: DataTypes.STRING,
  15. allowNull: false
  16. },
  17. created_at: {
  18. type: 'TIMESTAMP',
  19. allowNull: false,
  20. },
  21. updated_at: {
  22. type: 'TIMESTAMP',
  23. allowNull: true,
  24. },
  25. deleted_at: {
  26. type: 'TIMESTAMP',
  27. allowNull: false,
  28. },
  29. }, {
  30. tableName: 'teams',
  31. createdAt: false,
  32. updatedAt: false,
  33. undercored: true,
  34. });
  35. team.associate = function(models) {
  36. team.hasMany(models.task, {
  37. foreignKey: 'id_team',
  38. targetKey: 'id',
  39. as: 'taskTeam'
  40. });
  41. }
  42. return team;
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement