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.DropViewStatement; |
8 | |
import liquibase.util.StringUtils; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
public class DropViewChange extends AbstractChange { |
14 | |
private String schemaName; |
15 | |
private String viewName; |
16 | |
|
17 | |
public DropViewChange() { |
18 | 18 | super("dropView", "Drop View", ChangeMetaData.PRIORITY_DEFAULT); |
19 | 18 | } |
20 | |
|
21 | |
public String getSchemaName() { |
22 | 47 | return schemaName; |
23 | |
} |
24 | |
|
25 | |
public void setSchemaName(String schemaName) { |
26 | 2 | this.schemaName = StringUtils.trimToNull(schemaName); |
27 | 2 | } |
28 | |
|
29 | |
public String getViewName() { |
30 | 47 | return viewName; |
31 | |
} |
32 | |
|
33 | |
public void setViewName(String viewName) { |
34 | 4 | this.viewName = viewName; |
35 | 4 | } |
36 | |
|
37 | |
public SqlStatement[] generateStatements(Database database) { |
38 | 46 | return new SqlStatement[] { new DropViewStatement(getSchemaName() == null ? database.getDefaultSchemaName() |
39 | |
: getSchemaName(), getViewName()), }; |
40 | |
} |
41 | |
|
42 | |
public String getConfirmationMessage() { |
43 | 1 | return "View " + getViewName() + " dropped"; |
44 | |
} |
45 | |
|
46 | |
} |