When downgrading to MySQL 5.6 from MySQL 5.7, keep in mind the following issues relating to features found in MySQL 5.7, but not in MySQL 5.6:
A trigger can have triggers for different combinations of
trigger event (
DELETE) and action time
before MySQL 5.7.2 cannot have multiple triggers that have
the same trigger event and action time. MySQL 5.7.2 lifts
this limitation and multiple triggers are permitted. This
change has implications for downgrades.
If you downgrade a server that supports multiple triggers to an older version that does not, the downgrade has these effects:
For each table that has triggers, all trigger
definitions remain in the
for the table. However, if there are multiple triggers
with the same trigger event and action time, the server
executes only one of them when the trigger event occurs.
For information about
.TRG files, see
If triggers for the table are added or dropped
subsequent to the downgrade, the server rewrites the
.TRG file. The rewritten
file retains only one trigger per combination of trigger
event and action time; the others are lost.
To avoid these problems, modify your triggers before downgrading. For each table that has multiple triggers per combination of trigger event and action time, convert each such set of triggers to a single trigger as follows:
For each trigger, create a stored routine that contains
all the code in the trigger. Values accessed using
OLD can be
passed to the routine using parameters. If the trigger
needs a single result value from the code, you can put
the code in a stored function and have the function
return the value. If the trigger needs multiple result
values from the code, you can put the code in a stored
procedure and return the values using
Drop all triggers for the table.
Create one new trigger for the table that invokes the stored routines just created. The effect for this trigger is thus the same as the multiple triggers it replaces.