Function not being migrated between Edelweiss and Fameflower

Description

Upgraded this module from v18.2.3 to v19.1.1 on https://bugfest.folio.ebsco.com and noticed that the following function did not get migrated between Edelweiss and Fameflower:

CREATE OR REPLACE FUNCTION tenantId_mod_inventory_storage.update_item_status_date () RETURNS trigger AS $$ DECLARE newStatus text; BEGIN newStatus = NEW.jsonb->'status'->>'name'; IF (newStatus IS DISTINCT FROM OLD.jsonb->'status'->>'name') THEN NEW.jsonb = jsonb_set(NEW.jsonb, '{status,date}', to_jsonb(to_char(CURRENT_TIMESTAMP(3) AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.ms"Z"')), true); ELSIF (OLD.jsonb->'status'->'date' IS NOT NULL) THEN NEW.jsonb = jsonb_set(NEW.jsonb, '{status,date}', OLD.jsonb->'status'->'date', true); ELSE NEW.jsonb = NEW.jsonb #- '{status, date}'; END IF; RETURN NEW; END; $$ LANGUAGE 'plpgsql' COST 100;

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:

Bohdan Suprun April 2, 2020 at 3:25 PM

Merged to master and to b19.1 branch. Closing as dev only.

Marc Johnson April 2, 2020 at 12:22 PM

why would you specify a fromModuleVersion that is en newer version than what you are releasing?? Just don't do it (omit the upgrade snippet). The upgrade is supposed to take you from whatever to YOUR CODE that manages the storage.

Indeed. The reason I'm asking the question is because wrote a test that I expected to fail, that upgraded to version 19.1.1, yet the script marked 19.2.0 was executed and so it instead succeeded.

This particular change is going to need to be issued as a bug fix release as well, so will likely go into 19.1.2.

A naive back port might not change the fromModuleVersion from 19.2.0 to 19.1.2 and so I wanted to find out what the system would do in that circumstance.

I think it might be confusing for a bug fix branch for 19.1.2 to contain upgrade steps for 19.2.0.

Bohdan Suprun April 2, 2020 at 12:02 PM

Hi ,

It is not a future release, it is current snapshot version (19.2.0). However, since it is a BugFest must fix, I guess that we're going to release a patch for BugFest (19.1.x).

Adam Dickmeiss April 2, 2020 at 12:00 PM

In the future, if this is confusing and causes trouble we could either.

1. Fail tenant init if current version is earlier than fromModuleVersion. Clearly fromModuleVersion is supposed to point to something in the past.

2. Ignore upgrade script if ALSO currentVersion is < fromModuleVersion.

I wouldn't recommend 2, because that typos etc.. would not be caught.

Adam Dickmeiss April 2, 2020 at 11:50 AM
Edited

.. why would you specify a fromModuleVersion that is en newerWarning version than what you are releasing?? Just don't do it (omit the upgrade snippet). The upgrade is supposed to take you from whatever to YOUR CODE that manges the storage.

It is also quite difficult to predict about the future...

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Prokopovych

Fix versions

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created March 31, 2020 at 3:35 AM
Updated April 9, 2020 at 4:13 PM
Resolved April 2, 2020 at 3:25 PM
TestRail: Cases
TestRail: Runs

Flag notifications