Agregar en el Modal campo de Nro Operario back y front

This commit is contained in:
2025-11-26 01:35:03 -03:00
parent 822ab5a1cb
commit 5b82418f0a
5 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
-- Migración: Agregar campo mechanic_employee_code a la tabla inspections
-- Fecha: 2025-11-26
-- Descripción: Agrega un campo para almacenar el código de operario del mecánico que realiza la inspección
-- Agregar columna mechanic_employee_code a la tabla inspections
ALTER TABLE inspections
ADD COLUMN IF NOT EXISTS mechanic_employee_code VARCHAR(50);
-- Comentario descriptivo
COMMENT ON COLUMN inspections.mechanic_employee_code IS 'Código de operario del mecánico que realiza la inspección (copiado del perfil de usuario)';
-- Actualizar inspecciones existentes con el employee_code del mecánico correspondiente
UPDATE inspections i
SET mechanic_employee_code = u.employee_code
FROM users u
WHERE i.mechanic_id = u.id
AND i.mechanic_employee_code IS NULL;
-- Verificar que la columna se agregó correctamente
SELECT column_name, data_type, character_maximum_length
FROM information_schema.columns
WHERE table_name = 'inspections'
AND column_name = 'mechanic_employee_code';