1 /*
2  * Copyright 2010-2020 Redgate Software Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *         http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.flywaydb.core.api;
17
18 /**
19  * Type of migration.
20  */

21 public enum MigrationType {
22     /**
23      * Schema creation migration.
24      */

25     SCHEMA(truefalse),
26
27     /**
28      * Baseline migration.
29      */

30     BASELINE(truefalse),
31
32     /**
33      * SQL migrations.
34      */

35     SQL(falsefalse),
36
37     /**
38      * Undo SQL migrations.
39      */

40     UNDO_SQL(falsetrue),
41
42     /**
43      * JDBC Java-based migrations.
44      */

45     JDBC(falsefalse),
46
47     /**
48      * Undo JDBC java-based migrations.
49      */

50     UNDO_JDBC(falsetrue),
51
52     /**
53      * Spring JDBC Java-based migrations.
54      *
55      * @deprecated Will be removed in Flyway 7.0. Use JDBC instead.
56      */

57     @Deprecated
58     SPRING_JDBC(falsefalse),
59
60     /**
61      * Undo Spring JDBC java-based migrations.
62      *
63      * @deprecated Will be removed in Flyway 7.0. Use UNDO_JDBC instead.
64      */

65     @Deprecated
66     UNDO_SPRING_JDBC(falsetrue),
67
68     /**
69      * Migrations using custom MigrationResolvers.
70      */

71     CUSTOM(falsefalse),
72
73     /**
74      * Undo migrations using custom MigrationResolvers.
75      */

76     UNDO_CUSTOM(falsetrue);
77
78     private final boolean synthetic;
79     private final boolean undo;
80
81     MigrationType(boolean synthetic, boolean undo) {
82         this.synthetic = synthetic;
83         this.undo = undo;
84     }
85
86     /**
87      * @return Whether this is a synthetic migration type, which is only ever present in the schema history table,
88      * but never discovered by migration resolvers.
89      */

90     public boolean isSynthetic() {
91         return synthetic;
92     }
93
94     /**
95      * @return Whether this is an undo migration, which has undone an earlier migration present in the schema history table.
96      */

97     public boolean isUndo() {
98         return undo;
99     }
100 }