Skip to content

Conversation

@goldenice
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds validation warnings for one-to-one relationships that lack unique constraints or unique indexes on the foreign key column. Without these constraints, the database cannot enforce the one-to-one cardinality, potentially allowing the relationship to become many-to-one.

Key Changes:

  • Added logic to detect missing unique constraints/indexes on one-to-one relationship columns
  • Introduced new warning code ORM-SV-3104 with descriptive messaging
  • Added comprehensive test coverage for the new validation scenario

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/tools/validateSchema.ts Implements the unique constraint/index check for one-to-one columns
src/errors/SchemaValidationError.ts Defines the new ORM-SV-3104 warning code and associated messages
tests/pg-backend/validateSchema.test.ts Adds three test cases covering scenarios with and without unique constraints

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@goldenice goldenice merged commit 3139d2c into main Oct 22, 2025
4 checks passed
@goldenice goldenice deleted the validate-uniqueness-one-to-one branch October 22, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants