mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
* feat(core): #3427 add OSS tenant migration scripts * clean(core): fixes after review * clean(core): make only one command for oss and EE migration * fix(core): user synchronisation command and clean PR --------- Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package io.kestra.repository.h2;
|
||||
|
||||
import io.kestra.jdbc.JooqDSLContextWrapper;
|
||||
import io.kestra.jdbc.repository.AbstractJdbcTenantMigration;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Table;
|
||||
|
||||
@Singleton
|
||||
@H2RepositoryEnabled
|
||||
public class H2TenantMigration extends AbstractJdbcTenantMigration {
|
||||
|
||||
protected H2TenantMigration(JooqDSLContextWrapper dslContextWrapper) {
|
||||
super(dslContextWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int updateTenantId(Table<?> table, DSLContext context) {
|
||||
String query = """
|
||||
UPDATE "%s"
|
||||
SET "value" = '{"tenantId":"%s",' || SUBSTRING("value", 2)
|
||||
WHERE JQ_STRING("value", '.tenantId') IS NULL
|
||||
""".formatted(table.getName(), "main");
|
||||
|
||||
return context.execute(query, "main");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user