1 | |
package liquibase.sqlgenerator.core; |
2 | |
|
3 | |
import liquibase.database.Database; |
4 | |
import liquibase.database.core.SQLiteDatabase; |
5 | |
import liquibase.exception.ValidationErrors; |
6 | |
import liquibase.sql.Sql; |
7 | |
import liquibase.sql.UnparsedSql; |
8 | |
import liquibase.sqlgenerator.SqlGenerator; |
9 | |
import liquibase.sqlgenerator.SqlGeneratorChain; |
10 | |
import liquibase.statement.core.ReindexStatement; |
11 | |
|
12 | 10 | public class ReindexGeneratorSQLite extends AbstractSqlGenerator<ReindexStatement> { |
13 | |
@Override |
14 | |
public int getPriority() { |
15 | 1 | return PRIORITY_DATABASE; |
16 | |
} |
17 | |
|
18 | |
@Override |
19 | |
public boolean supports(ReindexStatement statement, Database database) { |
20 | 0 | return (database instanceof SQLiteDatabase); |
21 | |
} |
22 | |
|
23 | |
public ValidationErrors validate(ReindexStatement reindexStatement, Database database, |
24 | |
SqlGeneratorChain sqlGeneratorChain) { |
25 | 0 | ValidationErrors validationErrors = new ValidationErrors(); |
26 | 0 | validationErrors.checkRequiredField("tableName", reindexStatement.getTableName()); |
27 | 0 | return validationErrors; |
28 | |
} |
29 | |
|
30 | |
public Sql[] generateSql(ReindexStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { |
31 | 0 | return new Sql[] { new UnparsedSql("REINDEX " |
32 | |
+ database.escapeTableName(statement.getSchemaName(), statement.getTableName())) }; |
33 | |
} |
34 | |
} |