The SqlGenerator implementations are responsible for determining whether the data contained in the SqlStatement method is valid using the validate method.
Naming Conventions:
Default SqlGenerators for a particular SqlStatement use the same name as the SqlStatement class, replacing
"Statement" with "Generator" (e.g.: CreateTableStatement -> CreateTableGenerator).
Database-specific or alternate SqlGenerators append a description of what makes them different appended
(e.g. CreateTableStatement -> CreateTableGeneratorOracle)
Note
There is only one instance of each SqlGenerator implementation created, and they must be thread safe.
Lifecycle:
SqlGeneratorFactory, liquibase.statement.SqlStatement , liquibase.sql.Sql
| Modifier and Type | Field and Description |
|---|---|
| public static final Sql[] | |
| public static final int | |
| public static final int |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public Sql[] | generateSql(T statement, Database database, SqlGeneratorChain<T> sqlGeneratorChain)
Generate the actual Sql for the given statement and database. |
| public boolean | generateStatementsIsVolatile(Database database)
Does this change require access to the database metadata? |
| public int | getPriority()
Redeclares liquibase. Of all the SqlGenerators that "support" a given SqlStatement/Database, SqlGeneratorFactory will return the one with the highest priority. |
| public boolean | |
| public ValidationErrors | validate(T statement, Database database, SqlGeneratorChain<T> sqlGeneratorChain)
Validate the data contained in the SqlStatement. |
| public Warnings |
| EMPTY_SQL | back to summary |
|---|---|
| public static final Sql[] EMPTY_SQL Represent an empty array of | |
| PRIORITY_DATABASE | back to summary |
|---|---|
| public static final int PRIORITY_DATABASE Hides liquibase. | |
| PRIORITY_DEFAULT | back to summary |
|---|---|
| public static final int PRIORITY_DEFAULT Hides liquibase. | |
| generateRollbackStatementsIsVolatile | back to summary |
|---|---|
| public boolean generateRollbackStatementsIsVolatile(Database database) | |
| generateSql | back to summary |
|---|---|
| public Sql[] generateSql(T statement, Database database, SqlGeneratorChain<T> sqlGeneratorChain) Generate the actual Sql for the given statement and database. | |
| generateStatementsIsVolatile | back to summary |
|---|---|
| public boolean generateStatementsIsVolatile(Database database) Does this change require access to the database metadata? If true, the change cannot be used in an updateSql-style command. | |
| getPriority | back to summary |
|---|---|
| public int getPriority() Redeclares liquibase. Of all the SqlGenerators that "support" a given SqlStatement/Database, SqlGeneratorFactory will return the one with the highest priority.
| |
| supports | back to summary |
|---|---|
| public boolean supports(T statement, Database database) Does this generator support the given statement/database combination? Do not validate the statement with this method, only return if it can support it. | |
| validate | back to summary |
|---|---|
| public ValidationErrors validate(T statement, Database database, SqlGeneratorChain<T> sqlGeneratorChain) Validate the data contained in the SqlStatement. If there are no errors, return an empty ValidationErrors object, not a null value. Liquibase will inspect the ValidationErrors result before attempting to call generateSql. | |
| warn | back to summary |
|---|---|
| public Warnings warn(T statementType, Database database, SqlGeneratorChain<T> sqlGeneratorChain) | |