@@ -49,85 +49,85 @@ public FlywayCreator withCallbacks(Collection<Callback> callbacks) {
49
49
public Flyway createFlyway (DataSource dataSource ) {
50
50
FluentConfiguration configure = Flyway .configure ();
51
51
52
- if (flywayRuntimeConfig .jdbcUrl .isPresent ()) {
53
- if (flywayRuntimeConfig .username .isPresent () && flywayRuntimeConfig .password .isPresent ()) {
54
- configure .dataSource (flywayRuntimeConfig .jdbcUrl .get (), flywayRuntimeConfig .username .get (),
55
- flywayRuntimeConfig .password .get ());
52
+ if (flywayRuntimeConfig .jdbcUrl () .isPresent ()) {
53
+ if (flywayRuntimeConfig .username () .isPresent () && flywayRuntimeConfig .password () .isPresent ()) {
54
+ configure .dataSource (flywayRuntimeConfig .jdbcUrl () .get (), flywayRuntimeConfig .username () .get (),
55
+ flywayRuntimeConfig .password () .get ());
56
56
} else {
57
57
throw new ConfigurationException (
58
58
"Username and password must be defined when a JDBC URL is provided in the Flyway configuration" );
59
59
}
60
60
} else {
61
- if (flywayRuntimeConfig .username .isPresent () && flywayRuntimeConfig .password .isPresent ()) {
61
+ if (flywayRuntimeConfig .username () .isPresent () && flywayRuntimeConfig .password () .isPresent ()) {
62
62
AgroalDataSource agroalDataSource = (AgroalDataSource ) dataSource ;
63
63
String jdbcUrl = agroalDataSource .getConfiguration ().connectionPoolConfiguration ()
64
64
.connectionFactoryConfiguration ().jdbcUrl ();
65
65
66
- configure .dataSource (jdbcUrl , flywayRuntimeConfig .username .get (),
67
- flywayRuntimeConfig .password .get ());
66
+ configure .dataSource (jdbcUrl , flywayRuntimeConfig .username () .get (),
67
+ flywayRuntimeConfig .password () .get ());
68
68
} else {
69
69
70
70
configure .dataSource (dataSource );
71
71
}
72
72
}
73
- if (flywayRuntimeConfig .initSql .isPresent ()) {
74
- configure .initSql (flywayRuntimeConfig .initSql .get ());
73
+ if (flywayRuntimeConfig .initSql () .isPresent ()) {
74
+ configure .initSql (flywayRuntimeConfig .initSql () .get ());
75
75
}
76
- if (flywayRuntimeConfig .connectRetries .isPresent ()) {
77
- configure .connectRetries (flywayRuntimeConfig .connectRetries .getAsInt ());
76
+ if (flywayRuntimeConfig .connectRetries () .isPresent ()) {
77
+ configure .connectRetries (flywayRuntimeConfig .connectRetries () .getAsInt ());
78
78
}
79
- if (flywayRuntimeConfig .defaultSchema .isPresent ()) {
80
- configure .defaultSchema (flywayRuntimeConfig .defaultSchema .get ());
79
+ if (flywayRuntimeConfig .defaultSchema () .isPresent ()) {
80
+ configure .defaultSchema (flywayRuntimeConfig .defaultSchema () .get ());
81
81
}
82
- if (flywayRuntimeConfig .schemas .isPresent ()) {
83
- configure .schemas (flywayRuntimeConfig .schemas .get ().toArray (EMPTY_ARRAY ));
82
+ if (flywayRuntimeConfig .schemas () .isPresent ()) {
83
+ configure .schemas (flywayRuntimeConfig .schemas () .get ().toArray (EMPTY_ARRAY ));
84
84
}
85
- if (flywayRuntimeConfig .table .isPresent ()) {
86
- configure .table (flywayRuntimeConfig .table .get ());
85
+ if (flywayRuntimeConfig .table () .isPresent ()) {
86
+ configure .table (flywayRuntimeConfig .table () .get ());
87
87
}
88
- configure .locations (flywayBuildTimeConfig .locations .toArray (EMPTY_ARRAY ));
89
- if (flywayRuntimeConfig .sqlMigrationPrefix .isPresent ()) {
90
- configure .sqlMigrationPrefix (flywayRuntimeConfig .sqlMigrationPrefix .get ());
88
+ configure .locations (flywayBuildTimeConfig .locations () .toArray (EMPTY_ARRAY ));
89
+ if (flywayRuntimeConfig .sqlMigrationPrefix () .isPresent ()) {
90
+ configure .sqlMigrationPrefix (flywayRuntimeConfig .sqlMigrationPrefix () .get ());
91
91
}
92
- if (flywayRuntimeConfig .repeatableSqlMigrationPrefix .isPresent ()) {
93
- configure .repeatableSqlMigrationPrefix (flywayRuntimeConfig .repeatableSqlMigrationPrefix .get ());
92
+ if (flywayRuntimeConfig .repeatableSqlMigrationPrefix () .isPresent ()) {
93
+ configure .repeatableSqlMigrationPrefix (flywayRuntimeConfig .repeatableSqlMigrationPrefix () .get ());
94
94
}
95
- configure .cleanDisabled (flywayRuntimeConfig .cleanDisabled );
96
- configure .baselineOnMigrate (flywayRuntimeConfig .baselineOnMigrate );
97
- configure .validateOnMigrate (flywayRuntimeConfig .validateOnMigrate );
98
- configure .validateMigrationNaming (flywayRuntimeConfig .validateMigrationNaming );
95
+ configure .cleanDisabled (flywayRuntimeConfig .cleanDisabled () );
96
+ configure .baselineOnMigrate (flywayRuntimeConfig .baselineOnMigrate () );
97
+ configure .validateOnMigrate (flywayRuntimeConfig .validateOnMigrate () );
98
+ configure .validateMigrationNaming (flywayRuntimeConfig .validateMigrationNaming () );
99
99
100
100
final String [] ignoreMigrationPatterns ;
101
- if (flywayRuntimeConfig .ignoreMigrationPatterns .isPresent ()) {
102
- ignoreMigrationPatterns = flywayRuntimeConfig .ignoreMigrationPatterns .get ();
101
+ if (flywayRuntimeConfig .ignoreMigrationPatterns () .isPresent ()) {
102
+ ignoreMigrationPatterns = flywayRuntimeConfig .ignoreMigrationPatterns () .get ();
103
103
} else {
104
104
List <String > patterns = new ArrayList <>(2 );
105
- if (flywayRuntimeConfig .ignoreMissingMigrations ) {
105
+ if (flywayRuntimeConfig .ignoreMissingMigrations () ) {
106
106
patterns .add ("*:Missing" );
107
107
}
108
- if (flywayRuntimeConfig .ignoreFutureMigrations ) {
108
+ if (flywayRuntimeConfig .ignoreFutureMigrations () ) {
109
109
patterns .add ("*:Future" );
110
110
}
111
111
// Default is *:Future
112
112
ignoreMigrationPatterns = patterns .toArray (new String [0 ]);
113
113
}
114
114
115
115
configure .ignoreMigrationPatterns (ignoreMigrationPatterns );
116
- configure .cleanOnValidationError (flywayRuntimeConfig .cleanOnValidationError );
117
- configure .outOfOrder (flywayRuntimeConfig .outOfOrder );
118
- if (flywayRuntimeConfig .baselineVersion .isPresent ()) {
119
- configure .baselineVersion (flywayRuntimeConfig .baselineVersion .get ());
116
+ configure .cleanOnValidationError (flywayRuntimeConfig .cleanOnValidationError () );
117
+ configure .outOfOrder (flywayRuntimeConfig .outOfOrder () );
118
+ if (flywayRuntimeConfig .baselineVersion () .isPresent ()) {
119
+ configure .baselineVersion (flywayRuntimeConfig .baselineVersion () .get ());
120
120
}
121
- if (flywayRuntimeConfig .baselineDescription .isPresent ()) {
122
- configure .baselineDescription (flywayRuntimeConfig .baselineDescription .get ());
121
+ if (flywayRuntimeConfig .baselineDescription () .isPresent ()) {
122
+ configure .baselineDescription (flywayRuntimeConfig .baselineDescription () .get ());
123
123
}
124
- configure .placeholders (flywayRuntimeConfig .placeholders );
125
- configure .createSchemas (flywayRuntimeConfig .createSchemas );
126
- if (flywayRuntimeConfig .placeholderPrefix .isPresent ()) {
127
- configure .placeholderPrefix (flywayRuntimeConfig .placeholderPrefix .get ());
124
+ configure .placeholders (flywayRuntimeConfig .placeholders () );
125
+ configure .createSchemas (flywayRuntimeConfig .createSchemas () );
126
+ if (flywayRuntimeConfig .placeholderPrefix () .isPresent ()) {
127
+ configure .placeholderPrefix (flywayRuntimeConfig .placeholderPrefix () .get ());
128
128
}
129
- if (flywayRuntimeConfig .placeholderSuffix .isPresent ()) {
130
- configure .placeholderSuffix (flywayRuntimeConfig .placeholderSuffix .get ());
129
+ if (flywayRuntimeConfig .placeholderSuffix () .isPresent ()) {
130
+ configure .placeholderSuffix (flywayRuntimeConfig .placeholderSuffix () .get ());
131
131
}
132
132
if (!callbacks .isEmpty ()) {
133
133
configure .callbacks (callbacks .toArray (new Callback [0 ]));
0 commit comments