001package io.ebeaninternal.dbmigration.ddlgeneration.platform; 002 003import io.ebeaninternal.dbmigration.ddlgeneration.DdlBuffer; 004import io.ebeaninternal.dbmigration.ddlgeneration.DdlWrite; 005 006import java.util.List; 007 008/** 009 * DB trigger update when a change occurs on a table with history. 010 */ 011public class DbTriggerUpdate { 012 013 private final String baseTableName; 014 015 private final String historyTableName; 016 017 private final DdlWrite writer; 018 019 private final List<String> columns; 020 021 public DbTriggerUpdate(String baseTableName, String historyTableName, DdlWrite writer, List<String> columns) { 022 this.baseTableName = baseTableName; 023 this.historyTableName = historyTableName; 024 this.writer = writer; 025 this.columns = columns; 026 } 027 028 /** 029 * Return the appropriate buffer for the current mode. 030 */ 031 public DdlBuffer historyViewBuffer() { 032 return writer.applyHistoryView(); 033 } 034 035 /** 036 * Return the appropriate buffer for the current mode. 037 */ 038 public DdlBuffer historyTriggerBuffer() { 039 return writer.applyHistoryTrigger(); 040 } 041 042 043 /** 044 * Return the appropriate drop dependency buffer for the current mode. 045 */ 046 public DdlBuffer dropDependencyBuffer() { 047 return writer.applyDropDependencies(); 048 } 049 050 /** 051 * Return the base table name. 052 */ 053 public String getBaseTable() { 054 return baseTableName; 055 } 056 057 /** 058 * Return the history table name. 059 */ 060 public String getHistoryTable() { 061 return historyTableName; 062 } 063 064 /** 065 * Return the included columns. 066 */ 067 public List<String> getColumns() { 068 return columns; 069 } 070 071}