2022-01-18 23:32:39 -06:00
|
|
|
const { DataTypes, Model } = require('sequelize');
|
|
|
|
|
const sequelize = require('../../config/sequelize.conf');
|
2022-01-18 23:55:49 -06:00
|
|
|
const Carrera = require('./Carrera');
|
2022-01-18 23:32:39 -06:00
|
|
|
|
|
|
|
|
class Usuario extends Model {}
|
|
|
|
|
Usuario.init(
|
|
|
|
|
{
|
|
|
|
|
idUsuario: {
|
|
|
|
|
type: DataTypes.INTEGER,
|
|
|
|
|
primaryKey: true,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
unique: true,
|
|
|
|
|
autoIncrement: true,
|
|
|
|
|
},
|
2022-01-18 23:55:49 -06:00
|
|
|
numeroCuenta: {
|
2022-01-27 17:16:57 -06:00
|
|
|
type: DataTypes.STRING(9),
|
2022-01-18 23:32:39 -06:00
|
|
|
allowNull: false,
|
|
|
|
|
unique: true,
|
|
|
|
|
},
|
|
|
|
|
nombre: {
|
|
|
|
|
type: DataTypes.STRING(70),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
defaultValue: null,
|
|
|
|
|
},
|
2022-03-15 00:23:09 -06:00
|
|
|
generacion: {
|
|
|
|
|
type: DataTypes.STRING(5),
|
2022-01-27 00:15:05 -06:00
|
|
|
allowNull: false,
|
|
|
|
|
},
|
2022-01-30 23:50:17 -06:00
|
|
|
idCarrera: {
|
|
|
|
|
type: DataTypes.INTEGER,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
2022-01-27 00:15:05 -06:00
|
|
|
carrera: {
|
|
|
|
|
type: DataTypes.STRING(60),
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
2022-01-18 23:32:39 -06:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sequelize,
|
|
|
|
|
modelName: 'Usuario',
|
|
|
|
|
tableName: 'usuario',
|
|
|
|
|
timestamps: false,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2022-05-10 22:59:06 -05:00
|
|
|
Usuario.belongsTo(Carrera, {
|
|
|
|
|
foreignKey: {
|
|
|
|
|
name: 'idCarrera',
|
|
|
|
|
type: DataTypes.INTEGER,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
|
|
|
|
});
|
2022-01-18 23:32:39 -06:00
|
|
|
|
|
|
|
|
module.exports = Usuario;
|