22 lines
907 B
JavaScript
22 lines
907 B
JavaScript
const { DataTypes } = require('sequelize');
|
|
const { sequelize } = require('../config/database');
|
|
|
|
const GradeHistory = sequelize.define('grade_histories', {
|
|
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true },
|
|
grade_id: { type: DataTypes.UUID, allowNull: false },
|
|
student_id: { type: DataTypes.UUID, allowNull: false },
|
|
old_score: { type: DataTypes.DECIMAL(5, 2) },
|
|
new_score: { type: DataTypes.DECIMAL(5, 2) },
|
|
changed_by: { type: DataTypes.UUID },
|
|
change_reason: { type: DataTypes.TEXT },
|
|
changed_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
created_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
updated_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
}, {
|
|
tableName: 'grade_histories',
|
|
timestamps: true,
|
|
underscored: true,
|
|
});
|
|
|
|
module.exports = GradeHistory;
|