Esta migración crea la tabla ofertas_empleos, diseñada para almacenar información sobre las ofertas de empleo publicadas por las empresas. La tabla incluye campos para los detalles del empleo, requisitos específicos, y relaciones con empresas y usuarios.
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('ofertas_empleos', {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
allowNull: false,
},
titulo: {
type: Sequelize.STRING,
allowNull: false,
},
descripcion: {
type: Sequelize.TEXT,
allowNull: false,
validate: {
len: [0, 255],
},
},
ubicacion: {
type: Sequelize.STRING,
allowNull: true,
},
salario: {
type: Sequelize.DECIMAL,
allowNull: true,
},
fechaPublicacion: {
type: Sequelize.DATE,
allowNull: true,
},
fechaCierre: {
type: Sequelize.DATE,
allowNull: true,
},
empresaId: {
type: Sequelize.INTEGER,
references: {
model: 'empresas',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE',
},
userId: {
type: Sequelize.INTEGER,
references: {
model: 'users',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE',
allowNull: false,
},
estatus: {
type: Sequelize.ENUM('Activo', 'Cerrado'),
allowNull: false,
defaultValue: 'Activo',
},
tags: {
type: Sequelize.TEXT,
},
modalidad: {
type: Sequelize.ENUM('Presencial', 'Virtual', 'Híbrido'),
allowNull: false,
defaultValue: 'Presencial',
},
tipoTrabajo: {
type: Sequelize.ENUM('Tiempo Completo', 'Tiempo Parcial', 'Por Proyecto'),
allowNull: false,
defaultValue: 'Tiempo Completo',
},
Funciones_Requerimiento: {
type: Sequelize.STRING,
allowNull: true,
},
Estudios_Requerimiento: {
type: Sequelize.STRING,
allowNull: true,
},
Experiencia_Requerimiento: {
type: Sequelize.STRING,
allowNull: true,
},
Conocimientos_Requerimiento: {
type: Sequelize.STRING,
allowNull: true,
},
Competencias_Requerimiento: {
type: Sequelize.STRING,
allowNull: true,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('ofertas_empleos');
}
};
id
INTEGERtitulo
STRINGdescripcion
TEXTubicacion
STRINGsalario
DECIMALfechaPublicacion y fechaCierre
DATEempresaId
INTEGERempresas. Con restricciones CASCADE para actualizaciones y eliminaciones.userId
users. Obligatoria.estatus
ENUM('Activo', 'Cerrado')tags
TEXTmodalidad
ENUM('Presencial', 'Virtual', 'Híbrido')Presencial.tipoTrabajo
ENUM('Tiempo Completo', 'Tiempo Parcial', 'Por Proyecto')Funciones_Requerimiento, Estudios_Requerimiento, etc.)
STRINGcreatedAt y updatedAt
DATE