Package org.pgcodekeeper.core.schema.ch
Class ChSchema
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.AbstractSchema
org.pgcodekeeper.core.schema.ch.ChSchema
- All Implemented Interfaces:
IHashable,ISchema,IStatement,IStatementContainer
Represents a ClickHouse database schema (database in ClickHouse terms).
Contains tables, views, dictionaries and has an associated engine type.
-
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(IStatement st) Adds a child statement to this container.appendAlterSQL(PgStatement newCondition, SQLScript script) Fill script with object changes and return change typevoidappendComments(SQLScript script) Appends comment SQL to the script if this statement has comments.booleancompare(PgStatement obj) This method does not account for nested child PgStatements.booleanDeep part ofPgStatement.equals(Object).voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.Gets a child statement by name and type.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.voidgetDropSQL(SQLScript script, boolean generateExists) Generates DROP SQL for this statement.getRelation(String name) Gets a relation by name.Gets all relations (tables, views, sequences) in this schema.voidMethods inherited from class org.pgcodekeeper.core.schema.AbstractSchema
addFunction, addSequence, addTable, addType, addView, getConstraintByName, getDatabase, getFunction, getFunctions, getIndexByName, getSequence, getSequences, getStatementContainer, getStatementContainers, getStatementType, getTable, getTables, getType, getView, getViews, shallowCopyMethods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendOwnerSQL, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getDeps, getDescendants, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, isSubElement, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent, getQualifiedName
-
Constructor Details
-
ChSchema
Creates a new ClickHouse schema with the specified name.- Parameters:
name- the name of the schema
-
-
Method Details
-
setEngine
-
getRelations
Description copied from interface:ISchemaGets all relations (tables, views, sequences) in this schema.- Specified by:
getRelationsin interfaceISchema- Overrides:
getRelationsin classAbstractSchema- Returns:
- a stream of relations
-
getRelation
Description copied from interface:ISchemaGets a relation by name.- Specified by:
getRelationin interfaceISchema- Overrides:
getRelationin classAbstractSchema- Parameters:
name- the relation name- Returns:
- found relation or null if no such relation has been found
-
getChild
Description copied from interface:IStatementContainerGets a child statement by name and type.- Specified by:
getChildin interfaceIStatementContainer- Overrides:
getChildin classAbstractSchema- Parameters:
name- the name of the child to findtype- the type of the child to find- Returns:
- the child statement, or null if not found
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Overrides:
addChildin classAbstractSchema- Parameters:
st- the child statement to add
-
getCreationSQL
Description copied from class:PgStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Specified by:
getCreationSQLin classPgStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from class:PgStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin classPgStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
getDropSQL
Description copied from class:PgStatementGenerates DROP SQL for this statement.- Overrides:
getDropSQLin classPgStatement- Parameters:
script- the SQL script to append the DROP statement togenerateExists- whether to include "IF EXISTS" in the DROP statement
-
getDbType
- Overrides:
getDbTypein classPgStatement
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Overrides:
computeHashin classAbstractSchema- Parameters:
hasher- the hasher instance to use for hash computation
-
compare
Description copied from class:PgStatementThis method does not account for nested child PgStatements. Shallow version ofPgStatement.equals(Object)- Overrides:
comparein classAbstractSchema
-
compareChildren
Description copied from class:PgStatementDeep part ofPgStatement.equals(Object). Compares all object's child PgStatements for equality.- Overrides:
compareChildrenin classAbstractSchema
-
appendComments
Description copied from class:PgStatementAppends comment SQL to the script if this statement has comments.- Overrides:
appendCommentsin classPgStatement- Parameters:
script- the SQL script to append comments to
-