Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CustomSqlChange |
|
| 1.0;1 |
1 | package liquibase.change.custom; | |
2 | ||
3 | import liquibase.database.Database; | |
4 | import liquibase.exception.CustomChangeException; | |
5 | import liquibase.statement.SqlStatement; | |
6 | ||
7 | /** | |
8 | * Interface to implement when creating a custom change that generates SQL. When updating a database, implementing this | |
9 | * interface is preferred over CustomTaskChange because the SQL can either be executed directly or saved to a text file | |
10 | * for later use depending on the migration mode used. To allow the change to be rolled back, also implement the | |
11 | * CustomSqlRollback interface. If your change requires sql-based logic and non-sql-based logic, it is best to create a | |
12 | * change set that contains a mix of CustomSqlChange and CustomTaskChange calls. | |
13 | * | |
14 | * @see liquibase.change.custom.CustomSqlRollback | |
15 | * @see liquibase.change.custom.CustomTaskChange | |
16 | */ | |
17 | public interface CustomSqlChange extends CustomChange { | |
18 | /** | |
19 | * Generates the SQL statements required to run the change | |
20 | * | |
21 | * @param database | |
22 | * the target {@link liquibase.database.Database} associated to this change's statements | |
23 | * @return an array of {@link SqlStatement}s with the statements | |
24 | * @throws liquibase.exception.CustomChangeException | |
25 | * if an exception occurs while processing this change | |
26 | * @throws liquibase.exception.UnsupportedChangeException | |
27 | * if this change is not supported by the {@link liquibase.database.Database} passed as argument | |
28 | */ | |
29 | public SqlStatement[] generateStatements(Database database) throws CustomChangeException; | |
30 | ||
31 | } |