Feat/registry provider uniqueness - #367
ugoocreates-pixel wants to merge 3 commits into
Conversation
|
👋 Thanks for the contribution! This PR contains code/test changes and CI workflows were never auto-triggered (a GitHub Actions safety requirement for cross-repo forks). To unblock this for merging, a maintainer needs to either:\n\n1. Manually click 'Approve and run workflows' on this PR's Actions tab via the GitHub UI, or\n2. Approve the pending CI on the PR checks page.\n\nOnce the CI checks pass, this can be merged. 🚀 |
check please |
Closes #259
Problem Statement
RegistryOrganization,RegistryLocation,RegistryAsset, andRegistryProjectmodels have anexternalIdcolumn representing keys in external systems. However, different external systems may share identical IDs. Since there was noproviderdimension on the registry tables, data integrity was lost if identicalexternalIdvalues collided across different providers.Solution
provider String?column to all four models (RegistryOrganization,RegistryLocation,RegistryAsset, andRegistryProject) inschema.prisma.@@unique([provider, externalId]).externalIdfrom different providers is accepted, whereas seeding them with the sameexternalIdand the same provider throws a uniqueness constraint violation.Verification
test/registry-uniqueness.spec.tsasserting the constraints on all four models.accepts seeding two organizations with the same externalId from different providers(Passed)rejects seeding two organizations with the same externalId from the same provider(Passed)verifies the uniqueness constraint on other registry models (Location, Asset, Project)(Passed)