Class Alter
- java.lang.Object
-
- com.datastax.driver.core.schemabuilder.Alter
-
public class Alter extends Object
An in-construction ALTER TABLE statement.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAlter.AddColumnAn ADD column clause.static classAlter.AlterColumnAn ALTER column clause.static classAlter.OptionsThe table options of an ALTER TABLE statement.static classAlter.RenameColumnA RENAME column clause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Alter.AddColumnaddColumn(String columnName)Add a new ADD column clause to this ALTER TABLE statement.Alter.AddColumnaddStaticColumn(String columnName)Add a new ADD column clause to this ALTER TABLE statement, to add a static column.Alter.AlterColumnalterColumn(String columnName)Add an ALTER column clause (to change the column type) to this ALTER TABLE statement.StringbuildInternal()SchemaStatementdropColumn(String columnName)Add a new DROP column clause to this ALTER TABLE statement.Alter.RenameColumnrenameColumn(String columnName)Add a new RENAME column clause to this ALTER TABLE statement.Alter.OptionswithOptions()Add options (WITH clause) to this 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.AlterColumninstance.
-
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.AddColumninstance.
-
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.AddColumninstance.
-
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.RenameColumninstance.
-
withOptions
public Alter.Options withOptions()
Add options (WITH clause) to this ALTER TABLE statement.- Returns:
- a new
Alter.Optionsinstance.
-
buildInternal
public String buildInternal()
-
-