1 | |
package liquibase.change.core; |
2 | |
|
3 | |
import liquibase.change.AbstractChange; |
4 | |
import liquibase.change.ChangeMetaData; |
5 | |
import liquibase.change.ChangeProperty; |
6 | |
import liquibase.database.Database; |
7 | |
import liquibase.statement.SqlStatement; |
8 | |
|
9 | |
import java.util.ArrayList; |
10 | |
import java.util.Arrays; |
11 | |
import java.util.List; |
12 | |
|
13 | |
public class AnonymousChange extends AbstractChange { |
14 | |
|
15 | 10 | @ChangeProperty(includeInSerialization = false) |
16 | |
private List<SqlStatement> statements = new ArrayList<SqlStatement>(); |
17 | |
|
18 | |
public AnonymousChange() { |
19 | 10 | this(new SqlStatement[0]); |
20 | 10 | } |
21 | |
|
22 | |
public AnonymousChange(SqlStatement... statement) { |
23 | 10 | super("anonymous", "Anonymous change", ChangeMetaData.PRIORITY_DEFAULT); |
24 | 10 | this.statements.addAll(Arrays.asList(statement)); |
25 | 10 | } |
26 | |
|
27 | |
public String getConfirmationMessage() { |
28 | 0 | return statements.size() + " statements executed"; |
29 | |
} |
30 | |
|
31 | |
public SqlStatement[] generateStatements(Database database) { |
32 | 0 | return statements.toArray(new SqlStatement[statements.size()]); |
33 | |
} |
34 | |
} |