Skip to content

Commit

Permalink
MODFISTO-345: Remove update_encumbrances_order_status.ftl (cross module)
Browse files Browse the repository at this point in the history
Remove update_encumbrances_order_status.ftl, a migration script for Iris (R1 2021) that makes illegal cross-module database schema reads.

Problem:

The migration script

https://github.com/folio-org/mod-finance-storage/blob/v7.0.6/src/main/resources/templates/db_scripts/migration/update_encumbrances_order_status.ftl

reads from ${myuniversity}_mod_orders_storage. This is an illegal cross-module database schema read. It is also executed when enabling mod-finance-storage for a tenant - at that time mod-orders-storage might not have been enabled for the tenant resulting in a failure.

This migration script is used to migrate from a version before Iris to Iris (R1 2021) or any later version. However, Iris (R1 2021) reached end of life and is out of support since the release of Kiwi (R3 2021) on 2022-01-13.

Therefore the migration is no longer needed and should be deleted. This fixes the illegal cross-module schema read problem.

(cherry picked from commit b73745a)
  • Loading branch information
julianladisch committed Sep 19, 2022
1 parent 03bdaca commit f66d5cb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 59 deletions.

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/resources/templates/db_scripts/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@
"snippetPath": "migration/update_order_encumbrance.sql",
"fromModuleVersion": "mod-finance-storage-7.0.0"
},
{
"run": "after",
"snippetPath": "migration/update_encumbrances_order_status.ftl",
"fromModuleVersion": "mod-finance-storage-7.0.3"
},
{
"run": "after",
"snippetPath": "migration/update_budget_summary_information.sql",
Expand Down
23 changes: 0 additions & 23 deletions src/test/java/org/folio/rest/impl/TenantSampleDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,16 @@
import static org.folio.rest.utils.TestEntities.EXPENSE_CLASS;
import static org.folio.rest.utils.TestEntities.FUND_TYPE;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.folio.StorageTestSuite;
import org.folio.rest.jaxrs.model.Parameter;
import org.folio.rest.jaxrs.model.TenantAttributes;
import org.folio.rest.jaxrs.model.TenantJob;
import org.folio.rest.persist.PostgresClient;
import org.folio.rest.tools.utils.ModuleName;
import org.folio.rest.utils.TestEntities;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import io.restassured.http.Header;
Expand All @@ -46,16 +33,6 @@ public class TenantSampleDataTest extends TestBase {

private static TenantJob tenantJob;

@BeforeAll
static void createPurchaseOrderTable() throws IOException, InterruptedException, ExecutionException, TimeoutException {
InputStream tableInput = TenantSampleDataTest.class.getClassLoader().getResourceAsStream("cross_module_migrations_schemas.sql");
String sqlFile = IOUtils.toString(Objects.requireNonNull(tableInput), StandardCharsets.UTF_8);
CompletableFuture<Void> schemaCreated = new CompletableFuture<>();
PostgresClient.getInstance(StorageTestSuite.getVertx()).runSQLFile(sqlFile, false)
.onComplete(listAsyncResult -> schemaCreated.complete(null));
schemaCreated.get(60, TimeUnit.SECONDS);
}

@AfterAll
public static void after() {
deleteTenant(tenantJob, ANOTHER_TENANT_HEADER);
Expand Down
20 changes: 0 additions & 20 deletions src/test/resources/cross_module_migrations_schemas.sql

This file was deleted.

0 comments on commit f66d5cb

Please sign in to comment.