-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove FileResource of type resource
- Loading branch information
amvanbaren
committed
Feb 4, 2025
1 parent
b8f25b0
commit 2603a67
Showing
11 changed files
with
62 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
server/src/main/java/org/eclipse/openvsx/migration/ExtractResourcesJobRequestHandler.java
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
server/src/main/java/org/eclipse/openvsx/migration/ExtractResourcesJobService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...n/java/org/eclipse/openvsx/migration/RemoveFileResourceTypeResourceJobRequestHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** ****************************************************************************** | ||
* Copyright (c) 2025 Precies. Software OU and others | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* ****************************************************************************** */ | ||
package org.eclipse.openvsx.migration; | ||
|
||
import org.eclipse.openvsx.util.NamingUtil; | ||
import org.jobrunr.jobs.annotations.Job; | ||
import org.jobrunr.jobs.context.JobRunrDashboardLogger; | ||
import org.jobrunr.jobs.lambdas.JobRequestHandler; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class RemoveFileResourceTypeResourceJobRequestHandler implements JobRequestHandler<MigrationJobRequest> { | ||
|
||
protected final Logger logger = new JobRunrDashboardLogger(LoggerFactory.getLogger(RemoveFileResourceTypeResourceJobRequestHandler.class)); | ||
|
||
private final MigrationService migrations; | ||
|
||
public RemoveFileResourceTypeResourceJobRequestHandler(MigrationService migrations) { | ||
this.migrations = migrations; | ||
} | ||
|
||
@Override | ||
@Job(name = "Remove FileResource of type 'resource'", retries = 3) | ||
public void run(MigrationJobRequest jobRequest) throws Exception { | ||
var resource = migrations.getResource(jobRequest); | ||
logger.info("Removing file resource: {} {}", NamingUtil.toLogFormat(resource.getExtension()), resource.getName()); | ||
migrations.removeFile(resource); | ||
migrations.deleteFileResource(resource); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
server/src/main/resources/db/migration/V1_50_FileResource_Remove_Resource.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- don't run removed migration | ||
UPDATE migration_item SET migration_scheduled = TRUE WHERE migration_script = 'V1_23__FileResource_Extract_Resources.sql'; | ||
|
||
INSERT INTO migration_item(id, migration_script, entity_id, migration_scheduled) | ||
SELECT nextval('hibernate_sequence'), 'V1_50_FileResource_Remove_Resource.sql', fr.id, FALSE | ||
FROM file_resource fr | ||
JOIN extension_version ev ON ev.id = fr.extension_id | ||
JOIN extension e ON e.id = ev.extension_id | ||
WHERE fr.type = 'resource' | ||
ORDER BY e.download_count DESC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters