diff --git a/src/db/migration/V20170918_2217__mantis9842.sql b/src/db/migration/V20170918_2217__mantis9842.sql new file mode 100644 index 000000000..53b495dae --- /dev/null +++ b/src/db/migration/V20170918_2217__mantis9842.sql @@ -0,0 +1,9 @@ +update + esquema_corrida ec + + set ec.ROLOPERATIVO_ID = (select ec2.ROLOPERATIVO2_ID from esquema_corrida ec2 where ec2.activo =1 and ec2.NUMCORRIDAPISOEXTRA= ec.numcorrida and ec2.indpisoextra =1) +where + (ec.NUMCORRIDAPISOEXTRA is null) + and exists (select * from esquema_corrida ec3 where ec3.activo = 1 and ec3.NUMCORRIDAPISOEXTRA = ec.numcorrida) + and ec.ROLOPERATIVO_ID <> (select ec4.ROLOPERATIVO2_ID from esquema_corrida ec4 where ec4.activo =1 and ec4.NUMCORRIDAPISOEXTRA = ec.numcorrida ) + and activo = 1; \ No newline at end of file