Skip to content

Commit

Permalink
fix: updated migration to handle existing SYSTEM account
Browse files Browse the repository at this point in the history
  • Loading branch information
MacQSL committed Mar 28, 2024
1 parent 020a5ab commit 9e9ada1
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ ALTER TABLE "user" ADD CONSTRAINT unq_user_identifier_and_uuid UNIQUE (user_iden
ALTER TABLE "user" DISABLE TRIGGER ALL;

-- In PRODUCTION environments this value already exits.
-- Using fallback values to handle the edge cases
INSERT INTO "user" (user_id, user_identifier, keycloak_uuid, create_user, update_user)
VALUES ('00000000-0000-0000-0000-000000000000','SYSTEM', NULL, '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000')
ON CONFLICT (user_identifier, keycloak_uuid) DO NOTHING;
VALUES (
coalesce(getuserid('SYSTEM'), '00000000-0000-0000-0000-000000000000'),
'SYSTEM',
NULL,
coalesce(getuserid('SYSTEM'), '00000000-0000-0000-0000-000000000000'),
coalesce(getuserid('SYSTEM'), '00000000-0000-0000-0000-000000000000'))
ON CONFLICT (user_id) DO NOTHING;


ALTER TABLE "user" ENABLE TRIGGER ALL;
-- Enable trigger after SYSTEM account rectified.
ALTER TABLE "user" ENABLE TRIGGER ALL;

INSERT INTO xref_taxon_measurement_quantitative (itis_tsn, measurement_name, min_value, max_value, unit, measurement_desc)
VALUES
Expand Down

1 comment on commit 9e9ada1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 94.66% 10310/10892
🟢 Branches 94.75% 577/609
🟢 Functions 89.84% 168/187
🟢 Lines 94.66% 10310/10892

Test suite run success

393 tests passing in 22 suites.

Report generated by 🧪jest coverage report action from 9e9ada1

Please sign in to comment.