-
Notifications
You must be signed in to change notification settings - Fork 0
EPMRPP-114079 || add SQL script to restore GitHub integration #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,93 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||||||||
| * Copyright 2026 EPAM Systems | ||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||
| * you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||||||
| * You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||
| * Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||
| * See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||
| * limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| package com.epam.reportportal.extension.github.event.listener; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import static com.epam.reportportal.extension.github.GitHubExtension.SCHEMA_SCRIPTS_DIR; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import com.epam.reportportal.base.core.events.domain.PluginUploadedEvent; | ||||||||||||||||||||||||||||||||||||||||||||||
| import com.epam.reportportal.base.infrastructure.persistence.dao.IntegrationRepository; | ||||||||||||||||||||||||||||||||||||||||||||||
| import com.epam.reportportal.base.infrastructure.persistence.dao.IntegrationTypeRepository; | ||||||||||||||||||||||||||||||||||||||||||||||
| import com.epam.reportportal.extension.github.info.PluginInfoProvider; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.io.InputStream; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.nio.charset.StandardCharsets; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.util.Arrays; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.util.Comparator; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.util.Objects; | ||||||||||||||||||||||||||||||||||||||||||||||
| import javax.sql.DataSource; | ||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.SneakyThrows; | ||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.extern.slf4j.Slf4j; | ||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.context.ApplicationListener; | ||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.core.io.Resource; | ||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | ||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.jdbc.core.JdbcTemplate; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||
| * @author Andrei Piankouski | ||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||
| @Slf4j | ||||||||||||||||||||||||||||||||||||||||||||||
| public class PluginLoadedEventListener implements ApplicationListener<PluginUploadedEvent> { | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| private final String pluginId; | ||||||||||||||||||||||||||||||||||||||||||||||
| private final IntegrationTypeRepository integrationTypeRepository; | ||||||||||||||||||||||||||||||||||||||||||||||
| private final IntegrationRepository integrationRepository; | ||||||||||||||||||||||||||||||||||||||||||||||
| private final PluginInfoProvider pluginInfoProvider; | ||||||||||||||||||||||||||||||||||||||||||||||
| private final DataSource dataSource; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public PluginLoadedEventListener(String pluginId, | ||||||||||||||||||||||||||||||||||||||||||||||
| IntegrationTypeRepository integrationTypeRepository, | ||||||||||||||||||||||||||||||||||||||||||||||
| IntegrationRepository integrationRepository, PluginInfoProvider pluginInfoProvider, DataSource dataSource) { | ||||||||||||||||||||||||||||||||||||||||||||||
| this.pluginId = pluginId; | ||||||||||||||||||||||||||||||||||||||||||||||
| this.integrationTypeRepository = integrationTypeRepository; | ||||||||||||||||||||||||||||||||||||||||||||||
| this.integrationRepository = integrationRepository; | ||||||||||||||||||||||||||||||||||||||||||||||
| this.pluginInfoProvider = pluginInfoProvider; | ||||||||||||||||||||||||||||||||||||||||||||||
| this.dataSource = dataSource; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||||||||||
| public void onApplicationEvent(PluginUploadedEvent event) { | ||||||||||||||||||||||||||||||||||||||||||||||
| if (!supports(event)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| initSchema(); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| private boolean supports(PluginUploadedEvent event) { | ||||||||||||||||||||||||||||||||||||||||||||||
| return Objects.nonNull(event.getPluginActivityResource()) | ||||||||||||||||||||||||||||||||||||||||||||||
| && pluginId.equals(event.getPluginActivityResource().getName()); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @SneakyThrows | ||||||||||||||||||||||||||||||||||||||||||||||
| public void initSchema() { | ||||||||||||||||||||||||||||||||||||||||||||||
| PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(getClass().getClassLoader()); | ||||||||||||||||||||||||||||||||||||||||||||||
| Resource[] resources = resolver.getResources("classpath:" + SCHEMA_SCRIPTS_DIR + "/*.sql"); | ||||||||||||||||||||||||||||||||||||||||||||||
| log.debug("GitHub schema init: found {} script(s)", resources.length); | ||||||||||||||||||||||||||||||||||||||||||||||
| if (resources.length == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| Arrays.sort(resources, Comparator.comparing(Resource::getFilename)); | ||||||||||||||||||||||||||||||||||||||||||||||
| JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); | ||||||||||||||||||||||||||||||||||||||||||||||
| for (Resource r : resources) { | ||||||||||||||||||||||||||||||||||||||||||||||
| log.info("GitHub schema init: executing {}", r.getFilename()); | ||||||||||||||||||||||||||||||||||||||||||||||
| try (InputStream is = r.getInputStream()) { | ||||||||||||||||||||||||||||||||||||||||||||||
| String sql = new String(is.readAllBytes(), StandardCharsets.UTF_8); | ||||||||||||||||||||||||||||||||||||||||||||||
| jdbcTemplate.execute(sql); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+82
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's locate and examine the file
find . -name "PluginLoadedEventListener.java" -type fRepository: reportportal/plugin-auth-github Length of output: 175 🏁 Script executed: # Also search for any transaction-related configuration or usage
rg -i "transactionmanager|transactiontemplate|@transactional" --type java | head -20Repository: reportportal/plugin-auth-github Length of output: 170 🏁 Script executed: # Check for migration tools usage
rg -i "flyway|liquibase" --type javaRepository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Check for existing Spring configuration or DataSource management
rg "DataSource|JdbcTemplate" --type java -B 2 -A 2 | head -40Repository: reportportal/plugin-auth-github Length of output: 4518 🏁 Script executed: # Let's examine the actual file to see the full context of the initSchema method
cat -n src/main/java/com/epam/reportportal/extension/github/event/listener/PluginLoadedEventListener.java | sed -n '70,100p'Repository: reportportal/plugin-auth-github Length of output: 1178 🏁 Script executed: # Check what method this is part of and the full context
cat -n src/main/java/com/epam/reportportal/extension/github/event/listener/PluginLoadedEventListener.java | sed -n '60,110p'Repository: reportportal/plugin-auth-github Length of output: 1511 🏁 Script executed: # Let's also check if there's a PlatformTransactionManager bean configured in the project
rg "PlatformTransactionManager|TransactionManager" --type javaRepository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Check the Spring version and available transaction dependencies
fd "pom.xml|build.gradle" -type f | head -5Repository: reportportal/plugin-auth-github Length of output: 245 🏁 Script executed: # Find the build configuration files
find . -maxdepth 2 -name "pom.xml" -o -name "build.gradle"Repository: reportportal/plugin-auth-github Length of output: 89 🏁 Script executed: # Let's check the pom.xml to see Spring version and transaction dependencies
head -100 pom.xmlRepository: reportportal/plugin-auth-github Length of output: 141 🏁 Script executed: # Check if there's a PlatformTransactionManager configured anywhere
rg "PlatformTransactionManager|TransactionManager|@EnableTransactionManagement" --type javaRepository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Let's also check how the onApplicationEvent method is called - is it in a transaction context?
cat -n src/main/java/com/epam/reportportal/extension/github/event/listener/PluginLoadedEventListener.java | head -100Repository: reportportal/plugin-auth-github Length of output: 4331 🏁 Script executed: # Check the build.gradle for dependencies
cat build.gradleRepository: reportportal/plugin-auth-github Length of output: 3687 🏁 Script executed: # Search for transaction management in the broader codebase
rg "TransactionTemplate|DataSourceTransactionManager" --type javaRepository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Check if there's a test or configuration that shows how initSchema should behave
rg "initSchema" --type java -B 3 -A 3Repository: reportportal/plugin-auth-github Length of output: 1932 🏁 Script executed: # Check if PlatformTransactionManager is configured in the Spring context
rg "PlatformTransactionManager|TransactionManager|@EnableTransactionManagement|@Bean" --type java -A 2Repository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Let's check if there's any Spring configuration class that sets up transaction management
find . -name "*Config*" -type f | head -10Repository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Check the schema files to understand the complexity of the migrations
find . -name "*.sql" -type f 2>/dev/nullRepository: reportportal/plugin-auth-github Length of output: 137 🏁 Script executed: # Check if there's any existing issue or comment in the codebase about transactions for schema init
rg -i "schema|migration|transaction" --type java src/main/java/com/epam/reportportal/extension/github/event/listener/PluginLoadedEventListener.java -B 2 -A 2Repository: reportportal/plugin-auth-github Length of output: 1100 🏁 Script executed: # Check if `@Transactional` could be used instead - verify transaction manager availability
rg "spring.jpa.hibernate|spring.datasource|DataSourceAutoConfiguration" --type propertiesRepository: reportportal/plugin-auth-github Length of output: 109 🏁 Script executed: # Look for any Spring Boot auto-configuration or transaction setup
find . -name "application*.properties" -o -name "application*.yml"Repository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Check for Spring configuration files
find . -name "*.properties" -o -name "*.yml" -o -name "*.yaml"Repository: reportportal/plugin-auth-github Length of output: 316 🏁 Script executed: # Look for Spring Bean configuration
rg "@Configuration|@EnableTransactionManagement|transactionManager" --type javaRepository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Check if JdbcTemplate with DataSource auto-configures a transaction manager in Spring Boot
rg "class.*Configuration|@Bean" --type java -A 5 | head -40Repository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Let's check the schema file to understand what operations are being performed
cat src/main/resources/schema/001_restore_github_integration.sqlRepository: reportportal/plugin-auth-github Length of output: 986 🏁 Script executed: # Check if Spring Boot's auto-configuration includes transaction support for JdbcTemplate
rg "DataSourceTransactionManager|transactionManager" src/main --type javaRepository: reportportal/plugin-auth-github Length of output: 57 🏁 Script executed: # Verify Spring version and check if auto-configuration applies
cat build.gradle | grep -i "spring-boot"Repository: reportportal/plugin-auth-github Length of output: 150 Wrap schema initialization in a single database transaction to ensure atomicity. The Proposed fix (transaction wrapper)+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.support.TransactionTemplate;
...
public void initSchema() {
...
- JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
- for (Resource r : resources) {
- log.info("GitHub schema init: executing {}", r.getFilename());
- try (InputStream is = r.getInputStream()) {
- String sql = new String(is.readAllBytes(), StandardCharsets.UTF_8);
- jdbcTemplate.execute(sql);
- }
- }
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+ TransactionTemplate tx = new TransactionTemplate(new DataSourceTransactionManager(dataSource));
+ tx.executeWithoutResult(status -> {
+ for (Resource r : resources) {
+ log.info("GitHub schema init: executing {}", r.getFilename());
+ try (InputStream is = r.getInputStream()) {
+ String sql = new String(is.readAllBytes(), StandardCharsets.UTF_8);
+ jdbcTemplate.execute(sql);
+ } catch (Exception e) {
+ status.setRollbackOnly();
+ throw new IllegalStateException("Failed to execute schema script: " + r.getFilename(), e);
+ }
+ }
+ });📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| log.info("GitHub schema init: completed"); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2026 EPAM Systems | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.epam.reportportal.extension.github.info; | ||
|
|
||
| import com.epam.reportportal.base.infrastructure.persistence.entity.integration.IntegrationType; | ||
|
|
||
| /** | ||
| * @author <a href="mailto:ivan_budayeu@epam.com">Ivan Budayeu</a> | ||
| */ | ||
| public interface PluginInfoProvider { | ||
|
|
||
| IntegrationType provide(IntegrationType integrationType); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /* | ||
| * Copyright 2026 EPAM Systems | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.epam.reportportal.extension.github.info.impl; | ||
|
|
||
| import static java.util.Optional.ofNullable; | ||
|
|
||
| import com.epam.reportportal.base.infrastructure.persistence.entity.integration.IntegrationType; | ||
| import com.epam.reportportal.base.infrastructure.rules.exception.ErrorType; | ||
| import com.epam.reportportal.base.infrastructure.rules.exception.ReportPortalException; | ||
| import com.epam.reportportal.extension.github.info.PluginInfoProvider; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Paths; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
|
|
||
| /** | ||
| * @author <a href="mailto:ivan_budayeu@epam.com">Ivan Budayeu</a> | ||
| */ | ||
| public class PluginInfoProviderImpl implements PluginInfoProvider { | ||
|
|
||
| private static final String BINARY_DATA_KEY = "binaryData"; | ||
| private static final String DESCRIPTION_KEY = "description"; | ||
| private static final String METADATA_KEY = "metadata"; | ||
|
|
||
| private static final String PLUGIN_DESCRIPTION = | ||
| "The integration provides an exchange of information between ReportPortal and the Jira Cloud, such as posting issues and linking issues, getting updates on their statuses."; | ||
|
|
||
|
Comment on lines
+42
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect integration description references Jira instead of GitHub.
Proposed fix- private static final String PLUGIN_DESCRIPTION =
- "The integration provides an exchange of information between ReportPortal and the Jira Cloud, such as posting issues and linking issues, getting updates on their statuses.";
+ private static final String PLUGIN_DESCRIPTION =
+ "The integration provides an exchange of information between ReportPortal and GitHub, such as posting issues, linking issues, and getting updates on their statuses.";🤖 Prompt for AI Agents |
||
| static final Map<String, Object> PLUGIN_METADATA = Map.of( | ||
| "embedded", false, | ||
| "multiple", false | ||
| ); | ||
|
|
||
| private final String resourcesDir; | ||
| private final String propertyFile; | ||
|
|
||
| public PluginInfoProviderImpl(String resourcesDir, String propertyFile) { | ||
| this.resourcesDir = resourcesDir; | ||
| this.propertyFile = propertyFile; | ||
| } | ||
|
|
||
| @Override | ||
| public IntegrationType provide(IntegrationType integrationType) { | ||
| loadBinaryDataInfo(integrationType); | ||
| updateDescription(integrationType); | ||
| updateMetadata(integrationType); | ||
| return integrationType; | ||
| } | ||
|
|
||
| private void loadBinaryDataInfo(IntegrationType integrationType) { | ||
| Map<String, Object> details = integrationType.getDetails().getDetails(); | ||
| if (ofNullable(details.get(BINARY_DATA_KEY)).isEmpty()) { | ||
| try (InputStream propertiesStream = Files.newInputStream( | ||
| Paths.get(resourcesDir, propertyFile))) { | ||
| Properties binaryDataProperties = new Properties(); | ||
| binaryDataProperties.load(propertiesStream); | ||
| Map<String, String> binaryDataInfo = binaryDataProperties.entrySet().stream().collect( | ||
| HashMap::new, (map, entry) -> map.put(String.valueOf(entry.getKey()), | ||
| String.valueOf(entry.getValue()) | ||
| ), HashMap::putAll); | ||
| details.put(BINARY_DATA_KEY, binaryDataInfo); | ||
| } catch (IOException ex) { | ||
| throw new ReportPortalException(ErrorType.UNABLE_TO_LOAD_BINARY_DATA, ex.getMessage()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private void updateDescription(IntegrationType integrationType) { | ||
| Map<String, Object> details = integrationType.getDetails().getDetails(); | ||
| details.put(DESCRIPTION_KEY, PLUGIN_DESCRIPTION); | ||
| } | ||
|
|
||
| private void updateMetadata(IntegrationType integrationType) { | ||
| Map<String, Object> details = integrationType.getDetails().getDetails(); | ||
| details.put(METADATA_KEY, PLUGIN_METADATA); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| DO | ||
| ' | ||
| BEGIN | ||
| IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = ''integration_backup'') THEN | ||
|
|
||
| -- restore saml integration from backup | ||
| INSERT INTO integration (name, type, params, creator, creation_date, enabled) | ||
| SELECT ib.name, | ||
| (SELECT it.id FROM integration_type it WHERE it.auth_flow = ''OAUTH'' AND it.group_type = ''AUTH'' AND it.plugin_type = ''EXTENSION''), | ||
| ib.params, | ||
| ''SYSTEM'', | ||
| now(), | ||
| true | ||
| FROM integration_backup ib | ||
| WHERE ib.auth_type = ''github'' | ||
| ON CONFLICT (id) DO NOTHING; | ||
|
|
||
| -- delete backup record | ||
| DELETE from integration_backup ib WHERE ib.auth_type = ''github''; | ||
|
|
||
| -- drop table if empty | ||
| IF NOT EXISTS (SELECT 1 FROM integration_backup) THEN | ||
| DROP TABLE integration_backup; | ||
| END IF; | ||
| END IF; | ||
| END; | ||
| '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: reportportal/plugin-auth-github
Length of output: 8825
🏁 Script executed:
Repository: reportportal/plugin-auth-github
Length of output: 4331
Emit a warning log when no schema scripts are found.
The current code returns silently on line 79 with only a debug-level log when
resources.length == 0. In production deployments where debug logging is disabled, this masks potential issues like broken classpath patterns or failed resource packaging, causing database migrations to be skipped without any indication. Add alog.warn()call when zero SQL scripts are discovered to ensure deployment problems are visible.🤖 Prompt for AI Agents