Interface ICreateTableBuilder

All Superinterfaces:
IBaseBuilder
All Known Implementing Classes:
CreateTableBuilder, DryRunCreateTableBuilder

public interface ICreateTableBuilder extends IBaseBuilder
  • Method Details

    • column

      @CheckReturnValue default ICreateTableBuilder column(String columnName, SqlType<?> dataType)
      Add a column with a specific sql type. Adding auto-increment column automatically makes it a primary key.

      Note: to specify non-standard column names, use column(Token, SqlType) with Token.literal(String)

      Parameters:
      columnName - the name of the column, will be tokenized, for example "myColumn" will reference column "my_column" for MariaDb
      dataType - the type of the column
      Returns:
      this builder, for chaining. Remember to call IBaseBuilder.execute()
    • column

      @CheckReturnValue ICreateTableBuilder column(Token columnName, SqlType<?> dataType)
      Add a column with a specific sql type. Adding auto-increment column automatically makes it a primary key.
      Parameters:
      columnName - the name of the column
      dataType - the type of the column
      Returns:
      this builder, for chaining. Remember to call IBaseBuilder.execute()
    • column

      @CheckReturnValue default ICreateTableBuilder column(String columnName, Class<?> columnType)
      Add a column with a type deduced from a java class

      Note: to specify non-standard column names, use column(Token, Class) with Token.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()
    • column

      @CheckReturnValue default ICreateTableBuilder column(Token columnName, Class<?> columnType)
      Add a column with a type deduced from a java class
      Parameters:
      columnName - the name of the column
      columnType - the type of the column
      Returns:
      this builder, for chaining. Remember to call IBaseBuilder.execute()
    • primaryKey

      @CheckReturnValue default ICreateTableBuilder primaryKey(String firstColumn, String... columns)
      Add a primary key

      Note: to specify non-standard column names, use primaryKey(Token, Token...) with Token.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()
    • primaryKey

      @CheckReturnValue ICreateTableBuilder primaryKey(Token firstColumn, Token... columns)
      Add a primary key
      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()
    • foreignKey

      @CheckReturnValue default IForeignKeyBuilder<ICreateTableBuilder> foreignKey(String constraintName, String firstColumn, String... columns)
      Add a foreign key

      Note: to specify non-standard column names, use foreignKey(String, Token, Token...) with Token.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)
    • foreignKey

      @CheckReturnValue default IForeignKeyBuilder<ICreateTableBuilder> foreignKey(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)
    • foreignKey

      @CheckReturnValue default ICreateTableBuilder foreignKey(String constraintName, String[] columns, String referencedTable, String[] referencedColumns)
      Add a foreign key

      Note: to specify non-standard column names, use foreignKey(String, Token, Token...) with Token.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:
      this builder, for chaining. Remember to call IBaseBuilder.execute()
    • foreignKey

      @CheckReturnValue ICreateTableBuilder foreignKey(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:
      this builder, for chaining. Remember to call IBaseBuilder.execute()
    • unique

      @CheckReturnValue default ICreateTableBuilder unique(String constraintName, String firstColumn, String... columns)
      Add a unique constraint

      Note: to specify non-standard column names, use unique(String, Token, Token...) with Token.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()
    • unique

      @CheckReturnValue ICreateTableBuilder unique(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()
    • index

      @CheckReturnValue default ICreateTableBuilder index(String indexName, String firstColumn, String... columns)
      Add an index

      Note: to specify non-standard column names, use CreateTableBuilder.index(String, Token, Token...) with Token.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 CreateTableBuilder.execute()
    • index

      @CheckReturnValue ICreateTableBuilder index(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 CreateTableBuilder.execute()