mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
fix(core): tenant migration scripts now update keys
* chore(core): add keyboard shortcuts icon to flow editor tab (#8925) fix(core): don't send empty operations when migrating roles (#3807) Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io> * fix(core): migrate key that required tenant id to avoid duplication --------- Co-authored-by: Miloš Paunović <paun992@hotmail.com> Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package io.kestra.repository.h2;
|
||||
|
||||
import static io.kestra.core.tenant.TenantService.MAIN_TENANT;
|
||||
|
||||
import io.kestra.jdbc.JooqDSLContextWrapper;
|
||||
import io.kestra.jdbc.repository.AbstractJdbcTenantMigration;
|
||||
import jakarta.inject.Singleton;
|
||||
@@ -15,7 +17,7 @@ public class H2TenantMigration extends AbstractJdbcTenantMigration {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int updateTenantId(Table<?> table, DSLContext context) {
|
||||
protected int updateTenantIdField(Table<?> table, DSLContext context) {
|
||||
String query = """
|
||||
UPDATE "%s"
|
||||
SET "value" = '{"tenantId":"%s",' || SUBSTRING("value", 2)
|
||||
@@ -24,4 +26,17 @@ public class H2TenantMigration extends AbstractJdbcTenantMigration {
|
||||
|
||||
return context.execute(query, "main");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int updateTenantIdFieldAndKey(Table<?> table, DSLContext context) {
|
||||
String query = """
|
||||
UPDATE "%s"
|
||||
SET
|
||||
"key" = '%s_' || "key",
|
||||
"value" = '{"tenantId":"%s",' || SUBSTRING("value", 2)
|
||||
WHERE JQ_STRING("value", '.tenantId') IS NULL
|
||||
""".formatted(table.getName(), MAIN_TENANT, MAIN_TENANT);
|
||||
|
||||
return context.execute(query);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user