fix: add triggers to mysql snapshot

This commit is contained in:
Nybkox
2025-05-13 12:35:24 +02:00
parent 6e508e4454
commit f6699ad93b

View File

@@ -245,6 +245,7 @@ class Analyser extends DatabaseAnalyser {
parameters: functionNameToParameters[x.pureName], parameters: functionNameToParameters[x.pureName],
})), })),
triggers: triggers.rows.map(row => ({ triggers: triggers.rows.map(row => ({
objectId: 'triggers:' + row.triggerName,
contentHash: row.modifyDate, contentHash: row.modifyDate,
pureName: row.triggerName, pureName: row.triggerName,
eventType: row.eventType, eventType: row.eventType,
@@ -277,6 +278,7 @@ class Analyser extends DatabaseAnalyser {
const procedureModificationsQueryData = await this.analyserQuery('procedureModifications'); const procedureModificationsQueryData = await this.analyserQuery('procedureModifications');
const functionModificationsQueryData = await this.analyserQuery('functionModifications'); const functionModificationsQueryData = await this.analyserQuery('functionModifications');
const schedulerEvents = await this.analyserQuery('schedulerEvents'); const schedulerEvents = await this.analyserQuery('schedulerEvents');
const triggers = await this.analyserQuery('triggers');
return { return {
tables: tableModificationsQueryData.rows tables: tableModificationsQueryData.rows
@@ -307,17 +309,13 @@ class Analyser extends DatabaseAnalyser {
schedulerEvents: schedulerEvents.rows.map(row => ({ schedulerEvents: schedulerEvents.rows.map(row => ({
contentHash: _.isDate(row.LAST_ALTERED) ? row.LAST_ALTERED.toISOString() : row.LAST_ALTERED, contentHash: _.isDate(row.LAST_ALTERED) ? row.LAST_ALTERED.toISOString() : row.LAST_ALTERED,
pureName: row.EVENT_NAME, pureName: row.EVENT_NAME,
createSql: row.CREATE_SQL,
objectId: row.EVENT_NAME, objectId: row.EVENT_NAME,
intervalValue: row.INTERVAL_VALUE, })),
intervalField: row.INTERVAL_FIELD, triggers: triggers.rows.map(row => ({
starts: row.STARTS, contentHash: row.modifyDate,
status: row.STATUS, objectId: 'triggers:' + row.triggerName,
executeAt: row.EXECUTE_AT, pureName: row.triggerName,
lastExecuted: row.LAST_EXECUTED, tableName: row.tableName,
eventType: row.EVENT_TYPE,
definer: row.DEFINER,
objectTypeField: 'schedulerEvents',
})), })),
}; };
} }