Skip to content

Commit

Permalink
0004492: MySQL before 5.0.32 does not have drop trigger if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Aug 7, 2020
1 parent 793bb9f commit e98ca73
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ protected boolean doesTriggerExistOnPlatform(String catalog, String schema, Stri
public void removeTrigger(StringBuilder sqlBuffer, String catalogName, String schemaName,
String triggerName, String tableName, ISqlTransaction transaction) {
catalogName = catalogName == null ? "" : (catalogName + ".");
final String sql = "drop trigger if exists " + catalogName + triggerName;
String sql = "drop trigger if exists " + catalogName + triggerName;

if (getMajorVersion() < 5 || (getMajorVersion() == 5 && getMinorVersion() == 0 && Version.parseVersion(getProductVersion())[2] < 32)) {
sql = "drop trigger " + catalogName + triggerName;
}

logSql(sql, sqlBuffer);
if (parameterService.is(ParameterConstants.AUTO_SYNC_TRIGGERS)) {
transaction.execute(sql);
Expand Down

0 comments on commit e98ca73

Please sign in to comment.