-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for migration of Altinn1 and new index (#536)
- Support for Altinn 1 migration - Test remove sas token - Store mainaltinnversion - New index instances_lastchanged_filtered - Added exclude code coverage Co-authored-by: Henning Normann <h.normann@accenture.com>
- Loading branch information
1 parent
8b256ac
commit b68d207
Showing
18 changed files
with
196 additions
and
55 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
7 changes: 0 additions & 7 deletions
7
src/Storage/Migration/FunctionsAndProcedures/deletea2migrationstate.sql
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
src/Storage/Migration/FunctionsAndProcedures/deletemigrationstate.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,8 @@ | ||
CREATE OR REPLACE PROCEDURE storage.deletemigrationstate (_instanceguid UUID) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
BEGIN | ||
DELETE FROM storage.a1migrationstate WHERE instanceguid = _instanceguid; | ||
DELETE FROM storage.a2migrationstate WHERE instanceguid = _instanceguid; | ||
END; | ||
$BODY$; |
9 changes: 9 additions & 0 deletions
9
src/Storage/Migration/FunctionsAndProcedures/inserta1migrationstate.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,9 @@ | ||
CREATE OR REPLACE PROCEDURE storage.inserta1migrationstate (_a1archiveReference BIGINT) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
BEGIN | ||
INSERT INTO storage.a1migrationstate (a1archivereference) VALUES | ||
(_a1archiveReference) | ||
ON CONFLICT (a1archivereference) DO NOTHING; | ||
END; | ||
$BODY$; |
5 changes: 3 additions & 2 deletions
5
src/Storage/Migration/FunctionsAndProcedures/insertinstance.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
CREATE OR REPLACE PROCEDURE storage.insertinstance(_partyid BIGINT, _alternateid UUID, _instance JSONB, _created TIMESTAMPTZ, _lastchanged TIMESTAMPTZ, _org TEXT, _appid TEXT, _taskid TEXT) | ||
CREATE OR REPLACE PROCEDURE storage.insertinstance_v2(_partyid BIGINT, _alternateid UUID, _instance JSONB, _created TIMESTAMPTZ, _lastchanged TIMESTAMPTZ, _org TEXT, _appid TEXT, _taskid TEXT, _altinnmainversion INT) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
BEGIN | ||
INSERT INTO storage.instances(partyid, alternateid, instance, created, lastchanged, org, appid, taskid) VALUES (_partyid, _alternateid, jsonb_strip_nulls(_instance), _created, _lastchanged, _org, _appid, _taskid); | ||
INSERT INTO storage.instances(partyid, alternateid, instance, created, lastchanged, org, appid, taskid, altinnmainversion) | ||
VALUES (_partyid, _alternateid, jsonb_strip_nulls(_instance), _created, _lastchanged, _org, _appid, _taskid, _altinnmainversion); | ||
END; | ||
$BODY$; |
10 changes: 10 additions & 0 deletions
10
src/Storage/Migration/FunctionsAndProcedures/reada1migrationstate.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 @@ | ||
CREATE OR REPLACE FUNCTION storage.reada1migrationstate(_a1archivereference BIGINT) | ||
RETURNS TABLE (instanceguid UUID) | ||
LANGUAGE 'plpgsql' | ||
|
||
AS $BODY$ | ||
BEGIN | ||
RETURN QUERY | ||
SELECT ms.instanceguid FROM storage.a1migrationstate ms WHERE ms.a1archivereference = _a1archivereference; | ||
END; | ||
$BODY$; |
8 changes: 8 additions & 0 deletions
8
src/Storage/Migration/FunctionsAndProcedures/updatea1migrationstatestarted.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,8 @@ | ||
CREATE OR REPLACE PROCEDURE storage.updatea1migrationstatestarted (_a1archivereference BIGINT, _instanceguid UUID) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
BEGIN | ||
UPDATE storage.a1migrationstate SET instanceguid = _instanceguid, started = now() | ||
WHERE a1archivereference = _a1archivereference; | ||
END; | ||
$BODY$; |
8 changes: 0 additions & 8 deletions
8
src/Storage/Migration/FunctionsAndProcedures/updatea2migrationstatecompleted.sql
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/Storage/Migration/FunctionsAndProcedures/updatemigrationstatecompleted.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 @@ | ||
CREATE OR REPLACE PROCEDURE storage.updatemigrationstatecompleted (_instanceguid UUID) | ||
LANGUAGE 'plpgsql' | ||
AS $BODY$ | ||
BEGIN | ||
UPDATE storage.a1migrationstate SET completed = now() | ||
WHERE instanceguid = _instanceguid; | ||
UPDATE storage.a2migrationstate SET completed = now() | ||
WHERE instanceguid = _instanceguid; | ||
END; | ||
$BODY$; |
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,12 @@ | ||
CREATE TABLE IF NOT EXISTS storage.a1migrationstate | ||
( | ||
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, | ||
a1archivereference BIGINT UNIQUE NOT NULL, | ||
instanceguid UUID UNIQUE NULL, | ||
started TIMESTAMPTZ NULL, | ||
completed TIMESTAMPTZ NULL | ||
) | ||
TABLESPACE pg_default; | ||
|
||
GRANT SELECT,INSERT,UPDATE,REFERENCES,DELETE,TRUNCATE,REFERENCES,TRIGGER ON ALL TABLES IN SCHEMA storage TO platform_storage; | ||
GRANT SELECT,INSERT,UPDATE,REFERENCES,DELETE,TRUNCATE,REFERENCES,TRIGGER ON ALL TABLES IN SCHEMA storage TO platform_storage_admin; |
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 @@ | ||
-- This script is autogenerated from the tool DbTools. Do not edit manually. |
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,2 @@ | ||
CREATE INDEX IF NOT EXISTS instances_lastchanged_filtered ON storage.instances(lastChanged) | ||
WHERE (instance -> 'Status' -> 'IsArchived')::BOOLEAN = false; |
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
Oops, something went wrong.