Skip to content

Add detailed reporting for schema mismatches in 'not like target database' errors - #2778

Merged
SandPod merged 7 commits into
serverpod:mainfrom
klkucaj:improvement/1262
Oct 8, 2024
Merged

SandPod merged 7 commits into
serverpod:mainfrom
klkucaj:improvement/1262

Conversation

@klkucaj

@klkucaj klkucaj commented Sep 25, 2024 •

Copy link
Copy Markdown
Contributor

PR Description

Summary:
This PR introduces detailed reporting for schema mismatches in 'not like target database' errors. It adds a structured approach to handle and report differences in tables, columns, indexes, and foreign keys during schema comparison.

Key Changes:

  • Implemented detailed mismatch reporting for schema components such as tables, columns, indexes, and foreign keys.
  • Added support for reporting specific mismatches (e.g., missing, type mismatch, nullability mismatch) with clear and concise output.
  • Enhanced the toString() method for better readability of schema comparison warnings.
  • Updated and expanded unit tests to cover new reporting logic and ensure accuracy in identifying and displaying schema differences.

Closes: #1262

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

@SandPod SandPod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add some tests that validate this works as expected and produces the correct output for the different scenarios.

@klkucaj
klkucaj force-pushed the improvement/1262 branch 2 times, most recently from b4fc2f1 to 7af7394 Compare September 26, 2024 09:58
@klkucaj

klkucaj commented Sep 26, 2024

Copy link
Copy Markdown
Contributor Author

@SandPod done, also did some refactoring on comparison (like) methods.

@SandPod SandPod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another round of comments.

It is great to get good test coverage on this part of the code. The time spent there is really valuable.

Please think about the output that the user will see. We should make sure it is as clear as possible so that issues related to a table are nicely grouped together, and issues related to an index are also grouped together.

@klkucaj
klkucaj force-pushed the improvement/1262 branch 2 times, most recently from da816c3 to d4d052b Compare October 4, 2024 09:41

@SandPod SandPod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the changes are good now, we just need to polish the message so that the output makes sense to the developer.

@klkucaj

klkucaj commented Oct 8, 2024

Copy link
Copy Markdown
Contributor Author

@SandPod check the new update and let me know if this is good enough.

@klkucaj
klkucaj force-pushed the improvement/1262 branch 2 times, most recently from 8560acd to 41500c4 Compare October 8, 2024 11:30

@SandPod SandPod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! 🚀🚀

@SandPod
SandPod merged commit 84cc1b8 into serverpod:main Oct 8, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please report more info when not like the target database errors are given

2 participants