1 | |
package liquibase.sqlgenerator.core; |
2 | |
|
3 | |
import liquibase.database.Database; |
4 | |
import liquibase.database.typeconversion.TypeConverterFactory; |
5 | |
import liquibase.database.core.SybaseDatabase; |
6 | |
import liquibase.exception.ValidationErrors; |
7 | |
import liquibase.sql.Sql; |
8 | |
import liquibase.sql.UnparsedSql; |
9 | |
import liquibase.sqlgenerator.SqlGenerator; |
10 | |
import liquibase.sqlgenerator.SqlGeneratorChain; |
11 | |
import liquibase.statement.core.CreateDatabaseChangeLogTableStatement; |
12 | |
|
13 | 10 | public class CreateDatabaseChangeLogTableGeneratorSybase extends |
14 | |
AbstractSqlGenerator<CreateDatabaseChangeLogTableStatement> { |
15 | |
@Override |
16 | |
public int getPriority() { |
17 | 1 | return PRIORITY_DATABASE; |
18 | |
} |
19 | |
|
20 | |
@Override |
21 | |
public boolean supports(CreateDatabaseChangeLogTableStatement statement, Database database) { |
22 | 0 | return database instanceof SybaseDatabase; |
23 | |
} |
24 | |
|
25 | |
public ValidationErrors validate(CreateDatabaseChangeLogTableStatement statement, Database database, |
26 | |
SqlGeneratorChain sqlGeneratorChain) { |
27 | 0 | return new ValidationErrors(); |
28 | |
} |
29 | |
|
30 | |
public Sql[] generateSql(CreateDatabaseChangeLogTableStatement statement, Database database, |
31 | |
SqlGeneratorChain sqlGeneratorChain) { |
32 | 0 | return new Sql[] { new UnparsedSql("CREATE TABLE " |
33 | |
+ database.escapeTableName(database.getDefaultSchemaName(), database.getDatabaseChangeLogTableName()) |
34 | |
+ " (ID VARCHAR(150) NOT NULL, " + "AUTHOR VARCHAR(150) NOT NULL, " |
35 | |
+ "FILENAME VARCHAR(255) NOT NULL, " + "DATEEXECUTED " |
36 | |
+ TypeConverterFactory.getInstance().findTypeConverter(database).getDateTimeType() + " NOT NULL, " |
37 | |
+ "ORDEREXECUTED INT NOT NULL, " + "EXECTYPE VARCHAR(10) NOT NULL, " + "MD5SUM VARCHAR(35) NULL, " |
38 | |
+ "DESCRIPTION VARCHAR(255) NULL, " + "COMMENTS VARCHAR(255) NULL, " + "TAG VARCHAR(255) NULL, " |
39 | |
+ "LIQUIBASE VARCHAR(20) NULL, " + "PRIMARY KEY(ID, AUTHOR, FILENAME))") }; |
40 | |
|
41 | |
|
42 | |
|
43 | |
} |
44 | |
} |