Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ce-template-backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ccce
dev
ce-template-backend
Merge requests
!45
ICSHWI-10471
: introducing Flyway
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
ICSHWI-10471
: introducing Flyway
ICSHWI-10471_Introducing_Flyway
into
develop
Overview
0
Commits
1
Pipelines
1
Changes
5
Merged
Imre Toth
requested to merge
ICSHWI-10471_Introducing_Flyway
into
develop
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
5
Expand
👍
0
👎
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
30216b40
1 commit,
2 years ago
5 files
+
131
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
src/main/java/eu/ess/ics/ce/template/configuration/flyway/CeFlywayConfigurationCustomizer.java
0 → 100644
+
59
−
0
Options
/*
* Copyright (C) 2022 European Spallation Source ERIC.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package
eu.ess.ics.ce.template.configuration.flyway
;
import
org.flywaydb.core.api.configuration.FluentConfiguration
;
import
org.flywaydb.core.api.migration.JavaMigration
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.flyway.FlywayConfigurationCustomizer
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* Configuration for loading the migration classes (Spring Boot)
* Based on:
* <a href="https://stackoverflow.com/questions/48214783/flyway-spring-boot-autowired-beans-with-jpa-dependency">
* Flyway Spring Boot Autowired Beans with JPA Dependency
* </a>
*
* @author <a href="mailto:imre.toth@ess.eu">Imre Toth</a>
**/
@Component
public
class
CeFlywayConfigurationCustomizer
implements
FlywayConfigurationCustomizer
{
private
final
ApplicationContext
context
;
/**
* Flyway configurer constructor
*
* @param context Spring boot application context
*/
@Autowired
public
CeFlywayConfigurationCustomizer
(
ApplicationContext
context
)
{
this
.
context
=
context
;
}
@Override
public
void
customize
(
FluentConfiguration
configuration
)
{
Map
<
String
,
JavaMigration
>
migrationBeans
=
context
.
getBeansOfType
(
JavaMigration
.
class
);
JavaMigration
[]
migrationBeansAsArray
=
migrationBeans
.
values
().
toArray
(
new
JavaMigration
[
0
]);
configuration
.
javaMigrations
(
migrationBeansAsArray
);
}
}
Loading