Class SqlFixFactory
java.lang.Object
ch.tocco.nice2.model.entity.api.schema.AbstractDispatcher
ch.tocco.nice2.devcon.impl.modelvalidation.fix.AbstractFixFactory<String>
ch.tocco.nice2.devcon.impl.modelvalidation.fix.SqlFixFactory
- All Implemented Interfaces:
FixFactory<String>
Creates SQL statements that aim to fix a specific error. To add new fixes, create public
method, annotated with
Subscribe
and one argument that is the CheckEvent
a fix needs to be generated for. You can add multiple methods for one event, in that case
the outputs are concatenated. The method must be declared to return Iterable<String>
If the SQL is database specific, try to use liquibase' change classes and
toSql(Change)
to generate SQL statements. This takes care of some
database specific things. If the SQL complies to the SQL92 standard, you may omit it...-
Field Summary
Fields inherited from class ch.tocco.nice2.devcon.impl.modelvalidation.fix.AbstractFixFactory
nonVirtualFields, typeMap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFkConstraint
(NoFkConstraint event) addMissingFkColumn
(NoFkColumn event) protected Set
<com.google.common.reflect.TypeToken<?>> dropUnusedColumn
(UnusedColumn event) dropUnusedTable
(UnusedTable event) fixFieldSize
(InvalidFieldSize event) Varchar columns supported only atm.fixFkNotNull
(FkNotNullMismatch event) fixNoColumnforField
(NoFieldColumn event) fixTimeWithoutTimezone
(NoTimezone event) onNoTable
(NoTableEvent event) Methods inherited from class ch.tocco.nice2.devcon.impl.modelvalidation.fix.AbstractFixFactory
getFixes
Methods inherited from class ch.tocco.nice2.model.entity.api.schema.AbstractDispatcher
consider, dispatch, getDispatchClass
-
Constructor Details
-
SqlFixFactory
-
-
Method Details
-
allowedReturnTypes
- Overrides:
allowedReturnTypes
in classAbstractDispatcher
-
onUniqueConstraint
-
onNoTable
-
fixNoColumnforField
-
fixInvalidPrimaryKey
-
addFkConstraint
-
addBinaryFkConstranit
-
addMissingFkColumn
-
dropUnusedColumn
-
dropUnusedTable
-
fixNotnullMismatch
-
fixFkNotNull
-
fixInvalidSequenceValue
-
fixTimeWithoutTimezone
-
fixInvalidDataType
-
fixInvalidFkType
-
fixFieldDefaultValue
-
fixRelationDefaultValue
-
fixFieldSize
Varchar columns supported only atm. If nice field model is of type "text", the column type is changed to "text", else only the field size is adjusted.
-