Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = (sequelize, DataTypes) => {
- const team = sequelize.define('team', {
- id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- primaryKey: true,
- autoIncrement: true,
- },
- id_team: {
- type: DataTypes.STRING,
- allowNull: false,
- },
- name: {
- type: DataTypes.STRING,
- allowNull: false
- },
- created_at: {
- type: 'TIMESTAMP',
- allowNull: false,
- },
- updated_at: {
- type: 'TIMESTAMP',
- allowNull: true,
- },
- deleted_at: {
- type: 'TIMESTAMP',
- allowNull: false,
- },
- }, {
- tableName: 'teams',
- createdAt: false,
- updatedAt: false,
- undercored: true,
- });
- team.associate = function(models) {
- team.hasMany(models.task, {
- foreignKey: 'id_team',
- targetKey: 'id',
- as: 'taskTeam'
- });
- }
- return team;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement