rhkp commented on code in PR #2790:
URL:
https://github.com/apache/incubator-kie-tools/pull/2790#discussion_r1871998428
##########
packages/sonataflow-operator/internal/controller/platform/services/services.go:
##########
@@ -233,18 +249,51 @@ func (d *DataIndexHandler) hasPostgreSQLConfigured() bool
{
(d.platform.Spec.Persistence != nil &&
d.platform.Spec.Persistence.PostgreSQL != nil))
}
+func GetDBMigrationStrategy(persistence *operatorapi.PersistenceOptionsSpec)
operatorapi.DBMigrationStrategyType {
+ dbMigrationStrategy := operatorapi.DBMigrationStrategyNone
+
+ if persistence != nil {
+ return
operatorapi.DBMigrationStrategyType(persistence.DBMigrationStrategy)
+ }
+
+ return dbMigrationStrategy
+}
+
+func IsServiceBasedDBMigration(persistence
*operatorapi.PersistenceOptionsSpec) bool {
+ dbMigrationStrategy := GetDBMigrationStrategy(persistence)
+ return dbMigrationStrategy == operatorapi.DBMigrationStrategyService
+}
+
+func IsJobsBasedDBMigration(persistence *operatorapi.PersistenceOptionsSpec)
bool {
+ dbMigrationStrategy := GetDBMigrationStrategy(persistence)
+ return dbMigrationStrategy == operatorapi.DBMigrationStrategyJob
+}
+
+func IsNoDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool {
+ dbMigrationStrategy := GetDBMigrationStrategy(persistence)
+ return dbMigrationStrategy == operatorapi.DBMigrationStrategyNone ||
dbMigrationStrategy == ""
+}
+
+func isDBMigrationStrategyService(persistence
*v1alpha08.PersistenceOptionsSpec) string {
Review Comment:
Great point. The `isDBMigrationStrategyService` function returns `string`
version of serviceBasedDBMigration boolean flag. The string value is later used
as follows in `ConfigurePersistence()` function
`
// specific to DataIndex
c.Env = append(c.Env, corev1.EnvVar{Name:
quarkusHibernateORMDatabaseGeneration, Value: "update"}, corev1.EnvVar{Name:
quarkusFlywayMigrateAtStart, Value: dbMigrationStrategyService})
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]