-- Data migration script to transfer existing patient data from AspNetUsers -- to the new Pacientes table after cleanup migration -- First, let's identify users who had patient data by checking related tables -- This assumes you can determine which users were patients based on your application logic -- Modify this query according to how you identified patients in your original implementation SELECT 'INSERT INTOPacientes (Id, NombreContactoEmergencia, TelefonoContactoEmergencia, ' || 'TipoSangre, TieneAlergiasMedicamentosas, AlergiasDescripcion, FechaRegistro) VALUES ' || "('" || Id || "', 'old_value1', 'old_value2', 'O+', 0, '', UTC_TIMESTAMP());" FROM AspNetUsers where Discriminator = 'Paciente'; -- This won't work now since we removed the column -- Since we already removed the discriminator and patient columns, you'll need to -- manually identify which users were patients and use placeholders for their data -- Example query to generate INSERT statements (modify with actual data): -- SELECT -- 'INSERT INTO Pacientes (Id, NombreContactoEmergencia, TelefonoContactoEmergencia, ' -- || 'TipoSangre, TieneAlergiasMedicamentosas, AlergiasDescripcion, FechaRegistro) VALUES ' -- || "('" || Id || "', '', '', '', 0, '', UTC_TIMESTAMP());" -- FROM AspNetUsers -- WHERE [your_condition_to_identify_patients]; -- After running the generated INSERT statements manually, verify the data: SELECT * FROM Pacientes;