22
33import com .zaxxer .hikari .HikariDataSource ;
44import io .sentry .Sentry ;
5+ import lombok .Getter ;
56import lombok .Setter ;
67import lombok .extern .slf4j .Slf4j ;
78import org .flywaydb .core .Flyway ;
89import org .flywaydb .core .api .MigrationInfo ;
10+ import org .flywaydb .core .api .output .MigrateResult ;
911import org .hibernate .Session ;
1012import org .hibernate .query .Query ;
1113import org .jetbrains .annotations .NotNull ;
@@ -30,11 +32,13 @@ public class SQLConnector {
3032 /**
3133 * An Instance of the actual Java SQL Connection.
3234 */
35+ @ Getter
3336 private HikariDataSource dataSource ;
3437
3538 /**
3639 * An Instance of the SQL-Worker which works with the Data in the Database.
3740 */
41+ @ Getter
3842 private final SQLWorker sqlWorker ;
3943
4044 /**
@@ -113,7 +117,13 @@ public void runMigrations() {
113117 log .info ("No pending migrations found." );
114118 }
115119
116- flyway .migrate ();
120+ MigrateResult result = flyway .migrate ();
121+
122+ if (result .success ) {
123+ log .info ("Flyway Migrations were successful." );
124+ } else {
125+ log .error ("Flyway Migrations were unsuccessful." );
126+ }
117127 } catch (Exception exception ) {
118128 log .error ("Migration failed!" , exception );
119129 }
@@ -231,24 +241,6 @@ public void close() {
231241 }
232242 }
233243
234- /**
235- * Retrieve an Instance of the SQL-Connection.
236- *
237- * @return DataSource Instance of te SQL-Connection.
238- */
239- public HikariDataSource getDataSource () {
240- return dataSource ;
241- }
242-
243- /**
244- * Retrieve an Instance of the SQL-Worker to work with the Data.
245- *
246- * @return {@link SQLWorker} the Instance saved in this SQL-Connector.
247- */
248- public SQLWorker getSqlWorker () {
249- return sqlWorker ;
250- }
251-
252244 /**
253245 * Check if there was at least one successful Connection to the Database Server.
254246 *
0 commit comments