Class Alter


  • public class Alter
    extends Object
    An in-construction ALTER TABLE statement.
    • Method Detail

      • alterColumn

        public Alter.AlterColumn alterColumn​(String columnName)
        Add an ALTER column clause (to change the column type) to this ALTER TABLE statement.
        Parameters:
        columnName - the name of the column to be altered.
        Returns:
        a new Alter.AlterColumn instance.
      • addColumn

        public Alter.AddColumn addColumn​(String columnName)
        Add a new ADD column clause to this ALTER TABLE statement.
        Parameters:
        columnName - the name of the column to be added.
        Returns:
        a new Alter.AddColumn instance.
      • addStaticColumn

        public Alter.AddColumn addStaticColumn​(String columnName)
        Add a new ADD column clause to this ALTER TABLE statement, to add a static column.
        Parameters:
        columnName - the name of the column to be added.
        Returns:
        a new Alter.AddColumn instance.
      • dropColumn

        public SchemaStatement dropColumn​(String columnName)
        Add a new DROP column clause to this ALTER TABLE statement.

        Note that you cannot drop a column that is part of the primary key.

        Parameters:
        columnName - the name of the column to be dropped.
        Returns:
        the final ALTER TABLE DROP COLUMN statement.
      • renameColumn

        public Alter.RenameColumn renameColumn​(String columnName)
        Add a new RENAME column clause to this ALTER TABLE statement.

        Note that you can only rename a column that is part of the primary key.

        Parameters:
        columnName - the name of the column to be renamed.
        Returns:
        a new Alter.RenameColumn instance.
      • withOptions

        public Alter.Options withOptions()
        Add options (WITH clause) to this ALTER TABLE statement.
        Returns:
        a new Alter.Options instance.
      • buildInternal

        public String buildInternal()