1 | |
package liquibase.change.core; |
2 | |
|
3 | |
import liquibase.change.AbstractChange; |
4 | |
import liquibase.change.ChangeMetaData; |
5 | |
import liquibase.database.Database; |
6 | |
import liquibase.statement.SqlStatement; |
7 | |
import liquibase.statement.core.DropSequenceStatement; |
8 | |
import liquibase.util.StringUtils; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
public class DropSequenceChange extends AbstractChange { |
14 | |
|
15 | |
private String schemaName; |
16 | |
private String sequenceName; |
17 | |
|
18 | |
public DropSequenceChange() { |
19 | 21 | super("dropSequence", "Drop Sequence", ChangeMetaData.PRIORITY_DEFAULT); |
20 | 21 | } |
21 | |
|
22 | |
public String getSchemaName() { |
23 | 39 | return schemaName; |
24 | |
} |
25 | |
|
26 | |
public void setSchemaName(String schemaName) { |
27 | 0 | this.schemaName = StringUtils.trimToNull(schemaName); |
28 | 0 | } |
29 | |
|
30 | |
public String getSequenceName() { |
31 | 40 | return sequenceName; |
32 | |
} |
33 | |
|
34 | |
public void setSequenceName(String sequenceName) { |
35 | 7 | this.sequenceName = sequenceName; |
36 | 7 | } |
37 | |
|
38 | |
public SqlStatement[] generateStatements(Database database) { |
39 | 39 | return new SqlStatement[] { new DropSequenceStatement(getSchemaName() == null ? database.getDefaultSchemaName() |
40 | |
: getSchemaName(), getSequenceName()) }; |
41 | |
} |
42 | |
|
43 | |
public String getConfirmationMessage() { |
44 | 1 | return "Sequence " + getSequenceName() + " dropped"; |
45 | |
} |
46 | |
} |