Skip to content

fix: Prevent crashing when trying to load corrupt migration folder. - #1537

Merged
SandPod merged 6 commits into
serverpod:mainfrom
SandPod:1512-empty-migration-folder-crash
Nov 6, 2023
Merged

SandPod merged 6 commits into
serverpod:mainfrom
SandPod:1512-empty-migration-folder-crash

Conversation

@SandPod

@SandPod SandPod commented Nov 6, 2023

Copy link
Copy Markdown
Contributor

Change

  • Prevents crashing when corrupted migrations are attempted to be loaded.
  • Informs users about what has occurred and what actions to take.
Screenshot 2023-11-06 at 12 13 45

Minor refactors

  • Command returns exit code != 0 if migration could not be created.
  • Always use explicit module name for methods.
  • Remove inout parameter in favor of existing warning mechanism.
  • Initialize client just before it is used to enable unit testing error handling logic.

Closes: #1512

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

If you have done any breaking changes, make sure to outline them here, so that they can be included in the notes for the next release.

@SandPod
SandPod force-pushed the 1512-empty-migration-folder-crash branch 2 times, most recently from 860d2ce to 53c0a70 Compare November 6, 2023 11:21
@SandPod
SandPod force-pushed the 1512-empty-migration-folder-crash branch from 53c0a70 to ecbab0b Compare November 6, 2023 11:23
@SandPod
SandPod requested review from Isakdl and vlidholt November 6, 2023 13:36

@Isakdl Isakdl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See comment.

@Isakdl
Isakdl self-requested a review November 6, 2023 14:51

@Isakdl Isakdl left a comment

Copy link
Copy Markdown
Collaborator

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 04087c1 into serverpod:main Nov 6, 2023
@SandPod
SandPod deleted the 1512-empty-migration-folder-crash branch November 6, 2023 14:52
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 6, 2023
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.

Empty migration folder crashes create-migration command.

2 participants