UNPKG

@riao/dbal

Version:
25 lines 912 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateTimestampTrigger = void 0; const functions_1 = require("../../functions"); const trigger_1 = require("../trigger"); class UpdateTimestampTrigger extends trigger_1.DatabaseTrigger { constructor(options) { super(options); this.name = 'update_timestamp'; this.timing = 'BEFORE'; this.event = 'UPDATE'; this.column = options.column; this.idColumn = options.idColumn; } getBody(options) { return options.queryBuilder.triggerSetValue({ table: this.table, idColumn: this.idColumn, column: this.column, value: functions_1.DatabaseFunctions.currentTimestamp(), }); } } exports.UpdateTimestampTrigger = UpdateTimestampTrigger; //# sourceMappingURL=update-timestamp-trigger.js.map