Interface IAlterTableBuilder
- All Superinterfaces:
- IBaseBuilder
- All Known Implementing Classes:
- AlterTableBuilder,- DryRunAlterTableBuilder
- 
Method SummaryModifier and TypeMethodDescriptionAdd a column with a specific sql type.default IAlterTableBuilderAdd a column with a type deduced from a java class.default IAlterTableBuilderAdd a column with a specific sql type.default IAlterTableBuilderAdd a column with a type deduced from a java class.addColumnIfNotExists(Token columnName, SqlType<?> columnType) Add a column with a specific sql type.default IAlterTableBuilderaddColumnIfNotExists(Token columnName, Class<?> columnType) Add a column with a type deduced from a java class.default IAlterTableBuilderaddColumnIfNotExists(String columnName, SqlType<?> columnType) Add a column with a specific sql type.default IAlterTableBuilderaddColumnIfNotExists(String columnName, Class<?> columnType) Add a column with a type deduced from a java class.addForeignKey(String constraintName, Token[] columns, Token referencedTable, Token[] referencedColumns) Add a foreign keydefault IForeignKeyBuilder<IAlterTableBuilder>addForeignKey(String constraintName, Token firstColumn, Token... columns) Add a foreign keydefault IAlterTableBuilderaddForeignKey(String constraintName, String[] columns, String referencedTable, String[] referencedColumns) Add a foreign keydefault IForeignKeyBuilder<IAlterTableBuilder>addForeignKey(String constraintName, String firstColumn, String... columns) Add a foreign keyAdd an indexdefault IAlterTableBuilderAdd an indexaddPrimaryKey(Token firstColumn, Token... columns) Deprecated.default IAlterTableBuilderaddPrimaryKey(String firstColumn, String... columns) Deprecated.because it requires the table to not have a primary key, which is not allowed on MySQL ifsql_require_primary_keyis set.Add a unique constraintdefault IAlterTableBuilderAdd a unique constraintchangeColumnType(Token columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type.default IAlterTableBuilderchangeColumnType(Token columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class.default IAlterTableBuilderchangeColumnType(String columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type.default IAlterTableBuilderchangeColumnType(String columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class.changeColumnTypeIfExists(Token columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type, if it exists.default IAlterTableBuilderchangeColumnTypeIfExists(Token columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class, if it exists.default IAlterTableBuilderchangeColumnTypeIfExists(String columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type, if it exists.default IAlterTableBuilderchangeColumnTypeIfExists(String columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class, if it exists.changePrimaryKey(Token firstColumn, Token... columns) Change the primary key.default IAlterTableBuilderchangePrimaryKey(String firstColumn, String... columns) Change the primary key.dropColumn(Token columnName) Drop a column.default IAlterTableBuilderdropColumn(String columnName) Drop a column.dropColumnIfExists(Token columnName) Drop a column if it exists.default IAlterTableBuilderdropColumnIfExists(String columnName) Drop a column if it exists.dropForeignKey(String constraintName) Drop a foreign key.Drop an index.Deprecated.because it will fail on MySQL ifsql_require_primary_keyis set.Deprecated.because it will fail on MySQL ifsql_require_primary_keyis set.dropUnique(String constraintName) Drop a unique constraint.renameColumn(Token oldColumnName, Token newColumnName) Rename a column.default IAlterTableBuilderrenameColumn(String oldColumnName, String newColumnName) Rename a column.renameColumnIfPossible(Token oldColumnName, Token newColumnName) Rename a column if it exists and no column exists with the new name.default IAlterTableBuilderrenameColumnIfPossible(String oldColumnName, String newColumnName) Rename a column if it exists and no column exists with the new name.renameIndex(String oldIndexName, String newIndexName) Rename an indexrenameTable(Token newTableName) Rename a table.default IBaseBuilderrenameTable(String newTableName) Rename a table.renameTableIfPossible(Token newTableName) Rename a table if no table exists with the new name.default IBaseBuilderrenameTableIfPossible(String newTableName) Rename a table if no table exists with the new name.Methods inherited from interface com.valqueries.automapper.context.schema.IBaseBuilderexecute, getSql
- 
Method Details- 
renameTableRename a table.Note: This is a terminal statement. Note: to specify non-standard table names, use renameTable(Token)withToken.literal(String)- Parameters:
- newTableName- the new name of the table, will be tokenized, for example "myTable" will reference table "my_table" for MariaDb
- Returns:
- this builder, but no more chaining makes sense after this statement. Remember to call IBaseBuilder.execute()
 
- 
renameTableRename a table.Note: This is a terminal statement. - Parameters:
- newTableName- the new name of the table
- Returns:
- this builder, but no more chaining makes sense after this statement. Remember to call IBaseBuilder.execute()
 
- 
renameTableIfPossibleRename a table if no table exists with the new name.Note: This is a terminal statement. Note: to specify non-standard table names, use renameTableIfPossible(Token)withToken.literal(String)- Parameters:
- newTableName- the new name of the table, will be tokenized, for example "myTable" will reference table "my_table" for MariaDb
- Returns:
- this builder, but no more chaining makes sense after this statement. Remember to call IBaseBuilder.execute()
 
- 
renameTableIfPossibleRename a table if no table exists with the new name.Note: This is a terminal statement. - Parameters:
- newTableName- the new name of the table
- Returns:
- this builder, but no more chaining makes sense after this statement. Remember to call IBaseBuilder.execute()
 
- 
addColumnAdd a column with a specific sql type. Will fail if a column with the same name already exists. If you are adding auto-increment column it will be automatically made the new primary key.Note: to specify non-standard column names, use addColumn(Token, SqlType)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnAdd a column with a specific sql type. Will fail if a column with the same name already exists. If you are adding auto-increment column it will be automatically made the new primary key.- Parameters:
- columnName- the name of the column
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnAdd a column with a type deduced from a java class. Will fail if a column with the same name already exists.Note: to specify non-standard column names, use addColumn(Token, Class)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnAdd a column with a type deduced from a java class. Will fail if a column with the same name already exists.- Parameters:
- columnName- the name of the column
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnIfNotExists@CheckReturnValue default IAlterTableBuilder addColumnIfNotExists(String columnName, SqlType<?> columnType) Add a column with a specific sql type. Does nothing if a column with the same name already exists. If you are adding auto-increment column it will be automatically made the new primary key.Note: to specify non-standard column names, use addColumnIfNotExists(Token, SqlType)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnIfNotExistsAdd a column with a specific sql type. Does nothing if a column with the same name already exists. If you are adding auto-increment column it will be automatically made the new primary key.- Parameters:
- columnName- the name of the column
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnIfNotExists@CheckReturnValue default IAlterTableBuilder addColumnIfNotExists(String columnName, Class<?> columnType) Add a column with a type deduced from a java class. Does nothing if a column with the same name already exists.Note: to specify non-standard column names, use addColumnIfNotExists(Token, Class)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addColumnIfNotExists@CheckReturnValue default IAlterTableBuilder addColumnIfNotExists(Token columnName, Class<?> columnType) Add a column with a type deduced from a java class. Does nothing if a column with the same name already exists.- Parameters:
- columnName- the name of the column
- columnType- the type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
renameColumn@CheckReturnValue default IAlterTableBuilder renameColumn(String oldColumnName, String newColumnName) Rename a column.Note: to specify non-standard column names, use renameColumn(Token, Token)withToken.literal(String)- Parameters:
- oldColumnName- the old name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- newColumnName- the new name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
renameColumnRename a column.- Parameters:
- oldColumnName- the old name of the column
- newColumnName- the new name of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
renameColumnIfPossible@CheckReturnValue default IAlterTableBuilder renameColumnIfPossible(String oldColumnName, String newColumnName) Rename a column if it exists and no column exists with the new name.Note: to specify non-standard column names, use renameColumn(Token, Token)withToken.literal(String)- Parameters:
- oldColumnName- the old name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- newColumnName- the new name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
renameColumnIfPossible@CheckReturnValue IAlterTableBuilder renameColumnIfPossible(Token oldColumnName, Token newColumnName) Rename a column if it exists and no column exists with the new name.- Parameters:
- oldColumnName- the old name of the column
- newColumnName- the new name of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnType@CheckReturnValue default IAlterTableBuilder changeColumnType(String columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type.Note: to specify non-standard column names, use changeColumnType(Token, SqlType)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnTypeChange the type of column to a specific sql type. Auto-increment is not supported, you will have to drop the column and add a new one.- Parameters:
- columnName- the name of the column
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnType@CheckReturnValue default IAlterTableBuilder changeColumnType(String columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class.Note: to specify non-standard column names, use changeColumnType(Token, Class)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnType@CheckReturnValue default IAlterTableBuilder changeColumnType(Token columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class.- Parameters:
- columnName- the name of the column
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnTypeIfExists@CheckReturnValue default IAlterTableBuilder changeColumnTypeIfExists(String columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type, if it exists.Note: to specify non-standard column names, use changeColumnTypeIfExists(Token, SqlType)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnTypeIfExists@CheckReturnValue IAlterTableBuilder changeColumnTypeIfExists(Token columnName, SqlType<?> newColumnType) Change the type of column to a specific sql type, if it exists. Auto-increment is not supported, you will have to drop the column and add a new one.- Parameters:
- columnName- the name of the column
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnTypeIfExists@CheckReturnValue default IAlterTableBuilder changeColumnTypeIfExists(String columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class, if it exists.Note: to specify non-standard column names, use changeColumnTypeIfExists(Token, Class)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changeColumnTypeIfExists@CheckReturnValue default IAlterTableBuilder changeColumnTypeIfExists(Token columnName, Class<?> newColumnType) Change the type of column to a type deduced from a java class, if it exists.- Parameters:
- columnName- the name of the column
- newColumnType- the new type of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropColumnDrop a column. Will fail if the column does not exist.Note: to specify non-standard column names, use dropColumn(Token)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropColumnDrop a column. Will fail if the column does not exist.- Parameters:
- columnName- the name of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropColumnIfExistsDrop a column if it exists.Note: to specify non-standard column names, use dropColumnIfExists(Token)withToken.literal(String)- Parameters:
- columnName- the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropColumnIfExistsDrop a column if it exists.- Parameters:
- columnName- the name of the column
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addPrimaryKey@Deprecated @CheckReturnValue default IAlterTableBuilder addPrimaryKey(String firstColumn, String... columns) Deprecated.because it requires the table to not have a primary key, which is not allowed on MySQL ifsql_require_primary_keyis set.Add a primary key. If the table already has a primary key, usechangePrimaryKey(String, String...).Note: to specify non-standard column names, use addPrimaryKey(Token, Token...)withToken.literal(String)- Parameters:
- firstColumn- the first column of the primary key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columns- the rest of the columns of the primary key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addPrimaryKeyDeprecated.because it requires the table to not have a primary key, which is not allowed on MySQL ifsql_require_primary_keyis set.Add a primary key. If the table already has a primary key, usechangePrimaryKey(Token, Token...).- Parameters:
- firstColumn- the first column of the primary key
- columns- the rest of the columns of the primary key
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addForeignKey@CheckReturnValue default IForeignKeyBuilder<IAlterTableBuilder> addForeignKey(String constraintName, String firstColumn, String... columns) Add a foreign keyNote: to specify non-standard column names, use addForeignKey(String, Token, Token...)withToken.literal(String)- Parameters:
- constraintName- the name of the foreign key
- firstColumn- the first column of the foreign key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columns- the rest of the columns of the foreign key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- foreign key builder used to specify the referenced table and column(s)
 
- 
addForeignKey@CheckReturnValue default IForeignKeyBuilder<IAlterTableBuilder> addForeignKey(String constraintName, Token firstColumn, Token... columns) Add a foreign key- Parameters:
- constraintName- the name of the foreign key
- firstColumn- the first column of the foreign key
- columns- the rest of the columns of the foreign key
- Returns:
- foreign key builder used to specify the referenced table and column(s)
 
- 
addForeignKey@CheckReturnValue default IAlterTableBuilder addForeignKey(String constraintName, String[] columns, String referencedTable, String[] referencedColumns) Add a foreign keyNote: to specify non-standard column names, use addForeignKey(String, Token, Token...)withToken.literal(String)- Parameters:
- constraintName- the name of the foreign key
- columns- the columns of the foreign key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- referencedTable- the table referenced by the foreign key, will be tokenized, for example "myTable" will reference table "my_table" for MariaDb
- referencedColumns- the referenced columns of the foreign key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- foreign key builder used to specify the referenced table and column(s)
 
- 
addForeignKey@CheckReturnValue IAlterTableBuilder addForeignKey(String constraintName, Token[] columns, Token referencedTable, Token[] referencedColumns) Add a foreign key- Parameters:
- constraintName- the name of the foreign key
- columns- the columns of the foreign key
- referencedTable- the table referenced by the foreign key
- referencedColumns- the referenced columns of the foreign key
- Returns:
- foreign key builder used to specify the referenced table and column(s)
 
- 
addUnique@CheckReturnValue default IAlterTableBuilder addUnique(String constraintName, String firstColumn, String... columns) Add a unique constraintNote: to specify non-standard column names, use addUnique(String, Token, Token...)withToken.literal(String)- Parameters:
- constraintName- the name of the constraint
- firstColumn- the first column of the constraint, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columns- the rest of the columns of the constraint, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addUnique@CheckReturnValue IAlterTableBuilder addUnique(String constraintName, Token firstColumn, Token... columns) Add a unique constraint- Parameters:
- constraintName- the name of the constraint
- firstColumn- the first column of the constraint
- columns- the rest of the columns of the constraint
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addIndex@CheckReturnValue IAlterTableBuilder addIndex(String indexName, Token firstColumn, Token... columns) Add an index- Parameters:
- indexName- the name of the index
- firstColumn- the first column of the index
- columns- the rest of the columns of the index
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
addIndex@CheckReturnValue default IAlterTableBuilder addIndex(String indexName, String firstColumn, String... columns) Add an indexNote: to specify non-standard column names, use addIndex(String, Token, Token...)withToken.literal(String)- Parameters:
- indexName- the name of the index
- firstColumn- the first column of the index, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columns- the rest of the columns of the index, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changePrimaryKeyChange the primary key. Works regardless if the table already has a primary key or not.Note: to specify non-standard column names, use changePrimaryKey(Token, Token...)withToken.literal(String)- Parameters:
- firstColumn- the first column of the primary key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- columns- the rest of the columns of the primary key, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
changePrimaryKeyChange the primary key. Works regardless if the table already has a primary key or not.- Parameters:
- firstColumn- the first column of the primary key
- columns- the rest of the columns of the primary key
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
renameIndexRename an index- Parameters:
- oldIndexName- the old name of the index
- newIndexName- the new name of the index
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropPrimaryKeyDeprecated.because it will fail on MySQL ifsql_require_primary_keyis set.Drop a primary key without adding a new one. Consider usingchangePrimaryKey(String, String...)instead. If you are adding auto-increment column as a new primary key, do not use this method, but usechangePrimaryKey(String, String...)afterwards.- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropPrimaryKeyIfExistsDeprecated.because it will fail on MySQL ifsql_require_primary_keyis set.Drop a primary key if it exists, without adding a new one. Consider usingchangePrimaryKey(String, String...)instead. If you are adding auto-increment column as a new primary key, do not use this method, but usechangePrimaryKey(String, String...)afterwards.- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropForeignKeyDrop a foreign key. Will fail if the foreign key does not exist.- Parameters:
- constraintName- the name of the foreign key
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropUniqueDrop a unique constraint. Will fail if the constraint does not exist.- Parameters:
- constraintName- the name of the constraint
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
- 
dropIndexDrop an index. Will fail if the index does not exist.- Parameters:
- indexName- the name of the index
- Returns:
- this builder, for chaining. Remember to call IBaseBuilder.execute()
 
 
- 
sql_require_primary_keyis set.