Files
inscripciones_api/server/db/tablas/Alumno.js
T
2025-08-09 18:52:17 -06:00

60 lines
1.3 KiB
JavaScript

// db/tablas/Alumno.js
const { DataTypes } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Alumno = sequelize.define('Alumno', {
id_cuenta: {
type: DataTypes.STRING(9), // Aunque en DB es int(9) zerofill, mejor manejarlo como string con ceros a la izquierda
primaryKey: true,
allowNull: false,
},
nombre: {
type: DataTypes.STRING(300),
allowNull: false,
},
fecha_nacimiento: {
type: DataTypes.STRING(8), // Si quieres, puedes parsear fechas después
allowNull: true,
},
correo: {
type: DataTypes.STRING(100),
allowNull: true,
},
credito: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
fecha_actualizacion_credito: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
vigente: {
type: DataTypes.ENUM('si', 'no'),
allowNull: false,
defaultValue: 'si',
},
id_periodo: {
type: DataTypes.INTEGER,
allowNull: true,
},
fecha_registro: {
type: DataTypes.DATE,
allowNull: false,
},
id_carrera: {
type: DataTypes.INTEGER,
allowNull: false,
},
generacion: {
type: DataTypes.INTEGER,
allowNull: true,
},
}, {
tableName: 'alumno',
timestamps: false, // porque no hay campos createdAt/updatedAt explícitos
});
module.exports = Alumno;