fix: make seed imports idempotent by ignoring duplicate version_id #529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Fix seed imports to be idempotent by handling duplicate version_id conflicts
Motivation and Context
During seed data imports, duplicate version_id entries could cause database constraint violations and prevent the seed process from completing successfully. This fix makes the seed import
process idempotent by gracefully handling duplicate version_id conflicts using PostgreSQL's
ON CONFLICT DO NOTHINGclause.How Has This Been Tested?
Breaking Changes
No breaking changes. This is a backwards-compatible bug fix that improves the robustness of the seed import process.
Types of changes
Checklist
Additional context
The fix modifies the
CreateServermethod ininternal/database/postgres.goto useON CONFLICT (version_id) DO NOTHINGwhen inserting servers. This PostgreSQL-specific syntax ensures that ifa server with the same version_id already exists, the insert operation is silently ignored rather than throwing a constraint violation error.