remove cuestionario from all project. answers validated, time error reports
This commit is contained in:
@@ -10,9 +10,9 @@ const sequelize = new Sequelize(
|
||||
dialect: process.env.TYPEDB,
|
||||
logging: false,
|
||||
dialectOptions: {
|
||||
useUTC: false,
|
||||
timezone: "America/Mexico_City", // También en dialectOptions
|
||||
},
|
||||
timezone: '-05:00',
|
||||
timezone: '-06:00',
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -84,19 +84,37 @@ const getOld = async (body) => {
|
||||
const get = async (body) => {
|
||||
console.log(body);
|
||||
|
||||
const version = body.version
|
||||
const year = validarNumero(body.year, 'año', true, 4);
|
||||
const path = `server/uploads/${year}_cuestionario_alumno.csv`;
|
||||
const data = [];
|
||||
|
||||
console.log(year);
|
||||
let temp
|
||||
|
||||
return CuestionarioAlumno2.findAll({
|
||||
if(version == 'v1'){
|
||||
temp = CuestionarioAlumno.findAll({
|
||||
where: {
|
||||
idCuestionarioAlumno: {
|
||||
[Op.not]: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if(version == 'v2'){
|
||||
temp = CuestionarioAlumno2.findAll({
|
||||
where: {
|
||||
idCuestionarioAlumno2: {
|
||||
[Op.not]: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return temp
|
||||
.then(async (res) => {
|
||||
console.log('segunda parte', res);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
|
||||
const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
|
||||
const Cuestionario = require(`${dbPath}/Cuestionario`);
|
||||
|
||||
|
||||
const nuevoOld = async (body) => {
|
||||
@@ -187,12 +186,12 @@ const nuevo = async (body) => {
|
||||
return Servicio.findOne({ where: { idServicio } })
|
||||
.then(async (res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
/*
|
||||
if (res.idCuestionarioAlumno)
|
||||
|
||||
if (res.idCuestionarioAlumno2)
|
||||
throw new Error(
|
||||
'Este Servicio Social ya cuenta con cuestionario de alumno'
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
console.log('el servicio social si existe');
|
||||
// console.log(res);
|
||||
@@ -223,24 +222,24 @@ const nuevo = async (body) => {
|
||||
|
||||
// si idStatus está en el objeto, arrojamos el mensaje
|
||||
|
||||
/* if (messageByStatus.hasOwnProperty(res.idStatus))
|
||||
throw new Error(messageByStatus[res.idStatus]); */
|
||||
if (messageByStatus.hasOwnProperty(res.idStatus))
|
||||
throw new Error(messageByStatus[res.idStatus]);
|
||||
|
||||
// throw new Error('Id status no valido.'); // si no coincide con nada, error por defecto
|
||||
|
||||
// Cuestionario.findOne({});
|
||||
|
||||
let dataCuestionario = await Cuestionario.findOne({
|
||||
/* let dataCuestionario = await Cuestionario.findOne({
|
||||
where: { idServicio, dirigidoA: 'estudiantes' },
|
||||
});
|
||||
console.log('data cuestionario', dataCuestionario);
|
||||
|
||||
if (dataCuestionario) {
|
||||
throw new Error('Ya existe un cuestionario para este servicio social');
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
let cuestionarioRegistro = await Cuestionario.create({
|
||||
/* let cuestionarioRegistro = await Cuestionario.create({
|
||||
idServicio,
|
||||
// idCuestionarioAlumno: respuestasRegistradas.idCuestionarioAlumno,
|
||||
version: '2',
|
||||
@@ -248,14 +247,13 @@ const nuevo = async (body) => {
|
||||
titulo: 'Cuestionario de Alumn v2',
|
||||
desc: 'Cuestionario de Alumno v2',
|
||||
createdAt: new Date(),
|
||||
});
|
||||
}); */
|
||||
|
||||
|
||||
console.log("datos a registrar en la tabla cuestionarioAlumno2", { ...body, idCuestionario: cuestionarioRegistro.idCuestionario } );
|
||||
console.log("datos a registrar en la tabla cuestionarioAlumno2", { ...body} );
|
||||
|
||||
let respuestasRegistradas = await CuestionarioAlumno2.create({ ...body, idCuestionario: cuestionarioRegistro.idCuestionario });
|
||||
let respuestasRegistradas = await CuestionarioAlumno2.create({ ...body });
|
||||
console.log('despues de registrar cuestionario', respuestasRegistradas);
|
||||
console.log('cuestionario registrado', cuestionarioRegistro);
|
||||
|
||||
|
||||
|
||||
@@ -271,7 +269,7 @@ console.log("datos a registrar en la tabla cuestionarioAlumno2", { ...body, idC
|
||||
|
||||
|
||||
|
||||
return cuestionarioRegistro;
|
||||
return respuestasRegistradas;
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -66,19 +66,43 @@ const getOld = async (body) => {
|
||||
|
||||
|
||||
const get = async (body) => {
|
||||
const version = body.version
|
||||
|
||||
const year = validarNumero(body.year, 'año', true, 4);
|
||||
const path = `server/uploads/${year}_cuestionario_programa.csv`;
|
||||
const data = [];
|
||||
|
||||
let temp
|
||||
|
||||
if(version == 'v1'){
|
||||
|
||||
return CuestionarioPrograma2.findAll({
|
||||
temp = CuestionarioPrograma.findAll({
|
||||
where: {
|
||||
idCuestionarioPrograma2: {
|
||||
idCuestionarioPrograma: {
|
||||
[Op.not]: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(version == 'v2'){
|
||||
|
||||
temp = CuestionarioPrograma2.findAll({
|
||||
where: {
|
||||
idCuestionarioPrograma2: {
|
||||
[Op.not]: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return temp
|
||||
|
||||
.then(async (res) => {
|
||||
console.log("segunda parte", res);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
|
||||
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma2`);
|
||||
const Cuestionario = require(`${dbPath}/Cuestionario`);
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +87,7 @@ const nuevo = async (body) => {
|
||||
// console.log(body);
|
||||
|
||||
let idServicio = body.idServicio;
|
||||
body = validar.validarCuestionarioAlumno2(body);
|
||||
body = validar.validarCuestionarioPrograma2(body);
|
||||
|
||||
/*
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
@@ -101,12 +100,12 @@ const nuevo = async (body) => {
|
||||
return Servicio.findOne({ where: { idServicio } })
|
||||
.then(async (res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
/* if (res.idCuestionarioAlumno)
|
||||
if (res.idCuestionarioPrograma2)
|
||||
throw new Error(
|
||||
'Este Servicio Social ya cuenta con cuestionario de programa'
|
||||
); */
|
||||
);
|
||||
|
||||
console.log('el servicio social si existe');
|
||||
console.log('el servicio social si existe', res);
|
||||
// console.log(res);
|
||||
|
||||
/**
|
||||
@@ -133,14 +132,14 @@ const nuevo = async (body) => {
|
||||
|
||||
// if (res.idStatus) return CuestionarioPrograma2.create({ ...body });
|
||||
// si idStatus está en el objeto, arrojamos el mensaje
|
||||
/* if (messageByStatus.hasOwnProperty(res.idStatus))
|
||||
throw new Error(messageByStatus[res.idStatus]); */
|
||||
if (messageByStatus.hasOwnProperty(res.idStatus))
|
||||
throw new Error(messageByStatus[res.idStatus]);
|
||||
// throw new Error('Id status no valido.'); // si no coincide con nada, error por defecto
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
let dataCuestionario = await Cuestionario.findOne({
|
||||
where: { idServicio, dirigidoA: 'programas' },
|
||||
});
|
||||
@@ -150,9 +149,6 @@ const nuevo = async (body) => {
|
||||
throw new Error('Ya existe un cuestionario para este servicio social');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let cuestionarioRegistro = await Cuestionario.create({
|
||||
idServicio,
|
||||
//idCuestionarioPrograma: respuestasRegistradas.idCuestionarioPrograma,
|
||||
@@ -164,15 +160,16 @@ const nuevo = async (body) => {
|
||||
});
|
||||
|
||||
console.log('cuestionario registrado', cuestionarioRegistro);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// falta verificar que tenga solo un cuestionario
|
||||
|
||||
|
||||
|
||||
let respuestasRegistradas = await CuestionarioPrograma2.create({
|
||||
...body,
|
||||
idCuestionario: cuestionarioRegistro.idCuestionario
|
||||
});
|
||||
|
||||
console.log('despues de registrar cuestionario', respuestasRegistradas);
|
||||
@@ -194,7 +191,7 @@ const nuevo = async (body) => {
|
||||
|
||||
|
||||
|
||||
return cuestionarioRegistro;
|
||||
return respuestasRegistradas;
|
||||
})
|
||||
|
||||
.then((res) => validar.validarPreTermino(idServicio))
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const Servicio = require('./Servicio');
|
||||
|
||||
class Cuestionario extends Model {}
|
||||
|
||||
Cuestionario.init(
|
||||
{
|
||||
idCuestionario: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
idServicio: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: Servicio,
|
||||
key: 'idServicio',
|
||||
},
|
||||
},
|
||||
version: DataTypes.STRING(50),
|
||||
titulo: DataTypes.STRING(50),
|
||||
desc: DataTypes.STRING(50),
|
||||
dirigidoA: DataTypes.STRING(50),
|
||||
createdAt: DataTypes.DATE,
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Cuestionario',
|
||||
tableName: 'Cuestionario',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
/* Cuestionario.belongsTo(Servicio, { foreignKey: 'idServicio' });
|
||||
Servicio.hasMany(Cuestionario, { foreignKey: 'idServicio' });
|
||||
*/
|
||||
module.exports = Cuestionario;
|
||||
@@ -11,16 +11,9 @@ CuestionarioAlumno2.init(
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
idCuestionario: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
p1: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: true,
|
||||
@@ -224,11 +217,6 @@ CuestionarioAlumno2.init(
|
||||
}
|
||||
);
|
||||
|
||||
// Importación después de la definición para evitar dependencias circulares
|
||||
const Cuestionario = require('./Cuestionario');
|
||||
|
||||
// Definir relaciones después de importar correctamente
|
||||
CuestionarioAlumno2.belongsTo(Cuestionario, { foreignKey: 'idCuestionario' });
|
||||
Cuestionario.hasMany(CuestionarioAlumno2, { foreignKey: 'idCuestionario' });
|
||||
|
||||
module.exports = CuestionarioAlumno2;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
const Cuestionario = require('./Cuestionario');
|
||||
|
||||
|
||||
class CuestionarioPrograma2 extends Model {}
|
||||
@@ -17,12 +16,6 @@ CuestionarioPrograma2.init(
|
||||
},
|
||||
|
||||
|
||||
idCuestionario: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
},
|
||||
|
||||
|
||||
|
||||
// Sección p3_A_*
|
||||
p3_A_1: {
|
||||
@@ -143,9 +136,6 @@ CuestionarioPrograma2.init(
|
||||
);
|
||||
|
||||
|
||||
CuestionarioPrograma2.belongsTo(Cuestionario, { foreignKey: 'idCuestionario' });
|
||||
Cuestionario.hasMany(CuestionarioPrograma2, { foreignKey: 'idCuestionario' });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ const moment = require('moment');
|
||||
|
||||
const crearDDMMAAAA = (date) => {
|
||||
const fechaMoment = moment(date);
|
||||
|
||||
// const fechaMoment = moment(new Date(date).toISOString());
|
||||
|
||||
let ddmmaaaa = '';
|
||||
|
||||
if (fechaMoment.isValid())
|
||||
|
||||
+104
-2
@@ -206,7 +206,7 @@ const validarPreTermino = (idServicio) => {
|
||||
|
||||
|
||||
|
||||
const validarCuestionarioAlumno2 = (body) => {
|
||||
const validarCuestionarioAlumno2old = (body) => {
|
||||
console.log("Validando cuestionario alumno 2");
|
||||
|
||||
// Excluir p2 de la validación de campos nulos
|
||||
@@ -225,11 +225,64 @@ const validarCuestionarioAlumno2 = (body) => {
|
||||
return body;
|
||||
};
|
||||
|
||||
const validarCuestionarioAlumno2 = (body) => {
|
||||
console.log("Validando cuestionario alumno 2");
|
||||
|
||||
// Definir las claves que se consideran opcionales (las preguntas condicionales en el front)
|
||||
const optionalKeys = ['p5', 'p8', 'p16', 'p18'];
|
||||
|
||||
// Si p1 viene como array, concatenarla en una cadena separada por comas.
|
||||
if (Array.isArray(body.p1)) {
|
||||
body.p1 = body.p1.join(', ');
|
||||
}
|
||||
|
||||
// Verificar que cada campo obligatorio (no opcional) no esté vacío.
|
||||
for (const [key, value] of Object.entries(body)) {
|
||||
if (!optionalKeys.includes(key) && (value === null || value === undefined || value === '')) {
|
||||
throw new Error(`El campo ${key} no puede estar vacío.`);
|
||||
}
|
||||
}
|
||||
|
||||
// Lista de claves obligatorias esperadas (según la función formatearRespuestas en el front)
|
||||
const expectedKeys = [
|
||||
// Preguntas individuales obligatorias:
|
||||
"p1", "p2", "p4", "p6", "p7", "p9", "p13", "p14", "p15",
|
||||
// Las condicionales se consideran opcionales: p5, p8, p16 y p18
|
||||
|
||||
// Tablas:
|
||||
// Tabla 130 (numeroPregunta 3)
|
||||
"p3_1", "p3_2", "p3_3", "p3_4",
|
||||
// Tabla 104 (numeroPregunta 10)
|
||||
"p10_1", "p10_2", "p10_3",
|
||||
// Tabla 105 (numeroPregunta 11)
|
||||
"p11_1", "p11_2", "p11_3", "p11_4",
|
||||
// Tabla 106 (numeroPregunta 17)
|
||||
"p17_1", "p17_2", "p17_3",
|
||||
// Tabla 101 (numeroPregunta 12, sub "A. Habilidades personales")
|
||||
"p12_A_1", "p12_A_2", "p12_A_3", "p12_A_4",
|
||||
// Tabla 102 (numeroPregunta 12, sub "B. Habilidades profesionales")
|
||||
"p12_B_1", "p12_B_2", "p12_B_3", "p12_B_4",
|
||||
// Tabla 103 (numeroPregunta 12, sub "C. Habilidades sociales")
|
||||
"p12_C_1", "p12_C_2", "p12_C_3", "p12_C_4", "p12_C_5",
|
||||
// Tabla 1042 (numeroPregunta 12, sub "D. Conocimientos")
|
||||
"p12_D_1", "p12_D_2", "p12_D_3", "p12_D_4", "p12_D_5"
|
||||
];
|
||||
|
||||
for (const key of expectedKeys) {
|
||||
if (!(key in body)) {
|
||||
throw new Error(`Falta la respuesta para la pregunta ${key}.`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Validación exitosa. Todos los campos son válidos.");
|
||||
return body;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const validarCuestionarioPrograma2 = (body) => {
|
||||
|
||||
const validarCuestionarioPrograma2old = (body) => {
|
||||
console.log("Validando cuestionario programa 2");
|
||||
|
||||
// Excluir p2 de la validación de campos nulos
|
||||
@@ -249,6 +302,55 @@ const validarCuestionarioPrograma2 = (body) => {
|
||||
};
|
||||
|
||||
|
||||
const validarCuestionarioPrograma2 = (body) => {
|
||||
console.log("Validando cuestionario programa 2");
|
||||
|
||||
// Definir las claves condicionales (opcionales). En este caso, la pregunta 6 (porqueNoContrataria) es condicional.
|
||||
const camposOpcionales = ["p6"];
|
||||
|
||||
// Si la respuesta de p1 viene como array, concatenarla en una cadena
|
||||
if (Array.isArray(body.p1)) {
|
||||
body.p1 = body.p1.join(', ');
|
||||
}
|
||||
|
||||
// Verificar que cada campo obligatorio (no opcional) no esté vacío
|
||||
for (const [key, value] of Object.entries(body)) {
|
||||
if (!camposOpcionales.includes(key) && (value === null || value === undefined || value === '')) {
|
||||
throw new Error(`El campo ${key} no puede estar vacío.`);
|
||||
}
|
||||
}
|
||||
|
||||
// Lista de claves obligatorias esperadas (según el formateo que se usa en el front)
|
||||
const expectedKeys = [
|
||||
// Preguntas individuales obligatorias:
|
||||
"p1", "p2", "p4", "p5",
|
||||
// Las condicionales, como "p6", son opcionales
|
||||
|
||||
// Tablas:
|
||||
// Tabla 301 (sub "A. Habilidades personales")
|
||||
"p3_A_1", "p3_A_2", "p3_A_3", "p3_A_4",
|
||||
// Tabla 302 (sub "B. Habilidades profesionales")
|
||||
"p3_B_1", "p3_B_2", "p3_B_3", "p3_B_4",
|
||||
// Tabla 303 (sub "C. Habilidades sociales")
|
||||
"p3_C_1", "p3_C_2", "p3_C_3", "p3_C_4", "p3_C_5",
|
||||
// Tabla 304 (sub "D. Conocimientos")
|
||||
"p3_D_1", "p3_D_2", "p3_D_3", "p3_D_4", "p3_D_5"
|
||||
];
|
||||
|
||||
// Verificar que existan todas las claves obligatorias
|
||||
for (const key of expectedKeys) {
|
||||
if (!(key in body)) {
|
||||
throw new Error(`Falta la respuesta para la pregunta ${key}.`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Validación exitosa. Todos los campos son válidos.");
|
||||
return body;
|
||||
};
|
||||
|
||||
module.exports = { validarCuestionarioPrograma2 };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -185,6 +185,8 @@ app.put(`${route}/registro`, verificaToken, (req, res) => {
|
||||
app.put(`${route}/registro_validado`, verificaToken, (req, res) => {
|
||||
return registroValidado(req.body)
|
||||
.then((data) => {
|
||||
console.log('golasdf');
|
||||
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
-51
@@ -377,38 +377,11 @@ UNLOCK TABLES;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CREATE TABLE `servicio` (
|
||||
`idServicio` INT PRIMARY KEY
|
||||
); */
|
||||
--DROP TABLE IF EXISTS `Cuestionario`;
|
||||
|
||||
CREATE TABLE
|
||||
`Cuestionario` (
|
||||
`idCuestionario` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
`idServicio` INT,
|
||||
`version` VARCHAR(50),
|
||||
`titulo` VARCHAR(50),
|
||||
`desc` VARCHAR(50),
|
||||
`dirigidoA` VARCHAR(50),
|
||||
`createdAt` DATETIME
|
||||
);
|
||||
|
||||
--`idCuestionarioAlumno` INT, -- Agregado para relación con alumnos
|
||||
--`idCuestionarioPrograma` INT, -- Agregado para relación con programas
|
||||
-- `idCuestionarioAlumno1` INT, -- Agregado para relación con alumnos
|
||||
-- `idCuestionarioPrograma1` INT, -- Agregado para relación con programas
|
||||
|
||||
DROP TABLE IF EXISTS `cuestionario_alumno_2`;
|
||||
|
||||
CREATE TABLE
|
||||
`cuestionario_alumno_2` (
|
||||
`idCuestionarioAlumno2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
`idCuestionario` INT,
|
||||
`createdAt` DATETIME,
|
||||
`p12_A_1` VARCHAR(20),
|
||||
`p12_A_2` VARCHAR(20),
|
||||
@@ -461,7 +434,6 @@ DROP TABLE IF EXISTS `cuestionario_programa_2`;
|
||||
CREATE TABLE
|
||||
`cuestionario_programa_2` (
|
||||
`idCuestionarioPrograma2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
`idCuestionario` INT,
|
||||
`createdAt` DATETIME,
|
||||
`p3_A_1` VARCHAR(50),
|
||||
`p3_A_2` VARCHAR(50),
|
||||
@@ -490,19 +462,6 @@ CREATE TABLE
|
||||
`p7` VARCHAR(50)
|
||||
);
|
||||
|
||||
-- Relaciones corregidas
|
||||
ALTER TABLE `Cuestionario` ADD FOREIGN KEY (`idServicio`) REFERENCES `servicio` (`idServicio`);
|
||||
|
||||
ALTER TABLE cuestionario_alumno ADD COLUMN idCuestionario INT;
|
||||
ALTER TABLE cuestionario_programa ADD COLUMN idCuestionario INT;
|
||||
|
||||
ALTER TABLE `cuestionario_alumno` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
|
||||
ALTER TABLE `cuestionario_alumno_2` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
|
||||
ALTER TABLE `cuestionario_programa` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
|
||||
ALTER TABLE `cuestionario_programa_2` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
|
||||
|
||||
|
||||
-- agregar una columna de cuestionario 2
|
||||
|
||||
ALTER TABLE servicio ADD COLUMN idCuestionarioAlumno2 INT;
|
||||
ALTER TABLE servicio ADD COLUMN idCuestionarioPrograma2 INT;
|
||||
@@ -512,13 +471,3 @@ ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioPrograma2`) REFERENCES `c
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--ALTER TABLE `Cuestionario`
|
||||
--ADD FOREIGN KEY (`idCuestionarioAlumno`) REFERENCES `cuestionario_alumno_2` (`idCuestionarioAlumno2`);
|
||||
--ALTER TABLE `Cuestionario`
|
||||
--ADD FOREIGN KEY (`idCuestionarioPrograma`) REFERENCES `cuestionario_programa_2` (`idCuestionarioPrograma2`);
|
||||
--ALTER TABLE `Cuestionario`
|
||||
--ADD FOREIGN KEY (`idCuestionarioAlumno1`) REFERENCES `cuestionario_alumno` (`idCuestionarioAlumno`);
|
||||
--ALTER TABLE `Cuestionario`
|
||||
--ADD FOREIGN KEY (`idCuestionarioPrograma1`) REFERENCES `cuestionario_programa` (`idCuestionarioPrograma`);
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
|
||||
DROP TABLE IF EXISTS `cuestionario_alumno_2`;
|
||||
|
||||
CREATE TABLE
|
||||
`cuestionario_alumno_2` (
|
||||
`idCuestionarioAlumno2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
`createdAt` DATETIME,
|
||||
`p12_A_1` VARCHAR(20),
|
||||
`p12_A_2` VARCHAR(20),
|
||||
`p12_A_3` VARCHAR(20),
|
||||
`p12_A_4` VARCHAR(20),
|
||||
`p12_B_1` VARCHAR(20),
|
||||
`p12_B_2` VARCHAR(20),
|
||||
`p12_B_3` VARCHAR(20),
|
||||
`p12_B_4` VARCHAR(20),
|
||||
`p12_C_1` VARCHAR(20),
|
||||
`p12_C_2` VARCHAR(20),
|
||||
`p12_C_3` VARCHAR(20),
|
||||
`p12_C_4` VARCHAR(20),
|
||||
`p10_1` VARCHAR(20),
|
||||
`p10_2` VARCHAR(20),
|
||||
`p10_3` VARCHAR(20),
|
||||
`p11_1` VARCHAR(20),
|
||||
`p11_2` VARCHAR(20),
|
||||
`p11_3` VARCHAR(20),
|
||||
`p11_4` VARCHAR(20),
|
||||
`p17_1` VARCHAR(20),
|
||||
`p17_2` VARCHAR(20),
|
||||
`p17_3` VARCHAR(20),
|
||||
`p3_1` VARCHAR(50),
|
||||
`p3_2` VARCHAR(50),
|
||||
`p3_3` VARCHAR(50),
|
||||
`p3_4` VARCHAR(50),
|
||||
`p12_D_1` VARCHAR(50),
|
||||
`p12_D_2` VARCHAR(50),
|
||||
`p12_D_3` VARCHAR(50),
|
||||
`p12_D_4` VARCHAR(50),
|
||||
`p12_D_5` VARCHAR(50),
|
||||
`p1` TEXT,
|
||||
`p2` VARCHAR(50),
|
||||
`p4` VARCHAR(50),
|
||||
`p5` VARCHAR(50),
|
||||
`p6` VARCHAR(50),
|
||||
`p7` VARCHAR(50),
|
||||
`p8` VARCHAR(50),
|
||||
`p9` VARCHAR(50),
|
||||
`p13` VARCHAR(50),
|
||||
`p14` VARCHAR(50),
|
||||
`p15` VARCHAR(50),
|
||||
`p16` VARCHAR(50),
|
||||
`p18` VARCHAR(50)
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS `cuestionario_programa_2`;
|
||||
|
||||
CREATE TABLE
|
||||
`cuestionario_programa_2` (
|
||||
`idCuestionarioPrograma2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
`createdAt` DATETIME,
|
||||
`p3_A_1` VARCHAR(50),
|
||||
`p3_A_2` VARCHAR(50),
|
||||
`p3_A_3` VARCHAR(50),
|
||||
`p3_A_4` VARCHAR(50),
|
||||
`p3_B_1` VARCHAR(50),
|
||||
`p3_B_2` VARCHAR(50),
|
||||
`p3_B_3` VARCHAR(50),
|
||||
`p3_B_4` VARCHAR(50),
|
||||
`p3_C_1` VARCHAR(50),
|
||||
`p3_C_2` VARCHAR(50),
|
||||
`p3_C_3` VARCHAR(50),
|
||||
`p3_C_4` VARCHAR(50),
|
||||
`p3_C_5` VARCHAR(50),
|
||||
`p3_D_1` VARCHAR(50),
|
||||
`p3_D_2` VARCHAR(50),
|
||||
`p3_D_3` VARCHAR(50),
|
||||
`p3_D_4` VARCHAR(50),
|
||||
`p3_D_5` VARCHAR(50),
|
||||
`p3_E_1` VARCHAR(50),
|
||||
`p1` VARCHAR(50),
|
||||
`p2` VARCHAR(50),
|
||||
`p4` VARCHAR(50),
|
||||
`p5` VARCHAR(50),
|
||||
`p6` VARCHAR(50),
|
||||
`p7` VARCHAR(50)
|
||||
);
|
||||
|
||||
|
||||
|
||||
ALTER TABLE servicio ADD COLUMN idCuestionarioAlumno2 INT;
|
||||
ALTER TABLE servicio ADD COLUMN idCuestionarioPrograma2 INT;
|
||||
|
||||
ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioAlumno2`) REFERENCES `cuestionario_alumno_2` (`idCuestionarioAlumno2`);
|
||||
ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioPrograma2`) REFERENCES `cuestionario_programa_2` (`idCuestionarioPrograma2`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user