Class SchemaBuilder
java.lang.Object
com.valqueries.automapper.context.schema.SchemaBuilder
- All Implemented Interfaces:
ISchemaBuilder,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAlter an existing table.alterIfExists(Token table) Alter an existing table if it exists.voidclose()booleancolumnExists(Token table, Token column) Check if a column exists.Create a new table.voidcreateDatabaseAndUser(String databaseName, String username, String password) Creates a new database and user.createIfNotExists(Token table) Create a new table if it does not already exist.voidDrop an existing table.voiddropIfExists(Token table) Drop an existing table if it exists.booleanCheck if a table exists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.valqueries.automapper.context.schema.ISchemaBuilder
alter, alterIfExists, columnExists, create, createIfNotExists, drop, dropIfExists, exists
-
Constructor Details
-
SchemaBuilder
-
-
Method Details
-
create
Description copied from interface:ISchemaBuilderCreate a new table. Will fail if a table with the same name already exists.Note: remember to call
IBaseBuilder.execute()- Specified by:
createin interfaceISchemaBuilder- Parameters:
table- that will be created.- Returns:
- a builder that can be used to build the new table.
-
createIfNotExists
Description copied from interface:ISchemaBuilderCreate a new table if it does not already exist. Does nothing if a table with the same name already exists, no matter its contents.Note: remember to call
IBaseBuilder.execute()- Specified by:
createIfNotExistsin interfaceISchemaBuilder- Parameters:
table- that will be created if not already.- Returns:
- a builder that can be used to build the new table.
-
alter
Description copied from interface:ISchemaBuilderAlter an existing table.Note: remember to call
IBaseBuilder.execute()- Specified by:
alterin interfaceISchemaBuilder- Parameters:
table- that will be altered.- Returns:
- a builder that can be used to alter the table.
-
alterIfExists
Description copied from interface:ISchemaBuilderAlter an existing table if it exists.Note: remember to call
IBaseBuilder.execute()- Specified by:
alterIfExistsin interfaceISchemaBuilder- Parameters:
table- that will be altered if it exists.- Returns:
- a builder that can be used to alter the table.
-
drop
Description copied from interface:ISchemaBuilderDrop an existing table.- Specified by:
dropin interfaceISchemaBuilder- Parameters:
table- that will be dropped.
-
dropIfExists
Description copied from interface:ISchemaBuilderDrop an existing table if it exists.- Specified by:
dropIfExistsin interfaceISchemaBuilder- Parameters:
table- that will be dropped.
-
exists
Description copied from interface:ISchemaBuilderCheck if a table exists.- Specified by:
existsin interfaceISchemaBuilder- Parameters:
table- to be checked- Returns:
- true if the table exists, false otherwise
-
columnExists
Description copied from interface:ISchemaBuilderCheck if a column exists.- Specified by:
columnExistsin interfaceISchemaBuilder- Parameters:
table- the table to check incolumn- the column to be checked- Returns:
- true if the column exists, false otherwise
-
createDatabaseAndUser
Description copied from interface:ISchemaBuilderCreates a new database and user. The user will be granted all privileges on the database.- Specified by:
createDatabaseAndUserin interfaceISchemaBuilder- Parameters:
databaseName- The name of the database to createusername- The name of the user to createpassword- The password of the user to create
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceISchemaBuilder
-