Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve duplicate endpoints error message #327

Merged

Conversation

nguyenalter
Copy link
Contributor

@nguyenalter nguyenalter commented Feb 13, 2023

Summary

  • Improve duplicate endpoints error message
  • With this SQL code (MySQL):
    CREATE TABLE score_subject (
      subject_id INT,
      score_id INT,
      PRIMARY KEY (subject_id, score_id)
    );
    
    CREATE TABLE student (
      id INT PRIMARY KEY,
      first_name VARCHAR(100) NOT NULL,
      last_name VARCHAR(100) NOT NULL,
      score_id INT,
      subject_id INT,
      CONSTRAINT fk_student_score_subject_id
      FOREIGN KEY (subject_id, score_id) REFERENCES score_subject(subject_id, score_id)
    );
    
    ALTER TABLE student ADD FOREIGN KEY (subject_id, score_id) REFERENCES score_subject(subject_id, score_id);
    • The error message raises by CLI: Reference with same endpoints duplicated.
    • The improved error message: Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")

Issue

Lasting Changes (Technical)

  • Improve duplicate endpoints error message: adding schema, table and field information to the error message for more clarification

Checklist

Please check directly on the box once each of these are done

  • Documentation (if necessary)
  • Tests (integration test/unit test)
  • Integration Tests Passed
  • Code Review

Copy link
Contributor

@NQPhuc NQPhuc left a comment

Choose a reason for hiding this comment

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

LGTM!

@nguyenalter nguyenalter merged commit c11de91 into master Feb 16, 2023
@nguyenalter nguyenalter added the PR: Internal 🏡 A type of pull request used for changelog categories label Feb 17, 2023
@nguyenalter nguyenalter deleted the dbml-core/improve-duplicate-endpoints-error-message branch February 21, 2023 11:03
@coderabbitai coderabbitai bot mentioned this pull request Apr 25, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Internal 🏡 A type of pull request used for changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants