40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
'use strict'
|
|
const { Model } = require('sequelize')
|
|
const { logMsg } = require('../services/logger.js')
|
|
module.exports = (sequelize, DataTypes) => {
|
|
class Statementsmaster extends Model {
|
|
/**
|
|
* Helper method for defining associations.
|
|
* This method is not a part of Sequelize lifecycle.
|
|
* The `models/index` file will call this method automatically.
|
|
*/
|
|
// define association here
|
|
static associate({ Sectionsmaster }) {
|
|
this.hasMany(Sectionsmaster, { foreignKey: 'statement', as: 'sectionsmasterData' })
|
|
}
|
|
|
|
//Sectionsmaster.hasMany(Subsectionsmaster, { foreignKey: 'section', as: 'subsectionsmaster' })
|
|
|
|
}
|
|
|
|
Statementsmaster.init(
|
|
{
|
|
|
|
statement: { type: DataTypes.STRING },
|
|
is_active: { type: DataTypes.INTEGER },
|
|
createdby: { type: DataTypes.INTEGER },
|
|
updatedby: { type: DataTypes.INTEGER },
|
|
|
|
},
|
|
{
|
|
sequelize,
|
|
tableName: 'statementsmaster',
|
|
modelName: 'Statementsmaster',
|
|
createdAt: 'createdon',
|
|
updatedAt: 'updatedon',
|
|
}
|
|
)
|
|
// logMsg.info("Success-model ")
|
|
return Statementsmaster
|
|
}
|