001package io.ebeaninternal.dbmigration.ddlgeneration;
002
003import java.io.IOException;
004
005/**
006 * Object that represents an Alter Table statements. Table alters are grouped together by tableName in DDL and can be extended by
007 * a ddl-specific handler (e.g. doing a reorg for DB2 or implement special grouping for Hana). There is one instance per table.
008 * 
009 * @author TODO Roland Praml, FOCONIS AG
010 */
011public interface DdlAlterTable {
012
013  /**
014   * Writes the alter table statements to <code>target</code>
015   */
016  void write(Appendable target) throws IOException;
017
018  /**
019   * Adds an alter table command for given column. When you invoke<br>
020   * <code>alterTable(writer, "my_table").add("alter column","my_column).append("type integer")</code> the resulting DDL (in
021   * standard implementation) would be<br>
022   * <code>alter table my_table alter column my_column type integer</code>
023   * 
024   * @return a DdlBuffer, which can be used for further appends. Note you MUST NOT call <code>.endOfStatement()</code> on this
025   *         buffer.
026   */
027  DdlBuffer append(String operation, String columnName);
028
029  /**
030   * Adds a raw command. This is mainly used for executing user stored procedures.
031   */
032  DdlBuffer raw(String string);
033
034  /**
035   * Flag that detects if history DDL (switching on) is handled for this table.
036   */
037  boolean isHistoryHandled();
038
039  /**
040   * Sets the history handled flag for this table.
041   */
042  void setHistoryHandled();
043
044
045}