Skip to content

PendingMigrationsError: Change to more generic DatabaseError#871

Open
mao-sz wants to merge 3 commits into
TheOdinProject:mainfrom
mao-sz:database-error
Open

PendingMigrationsError: Change to more generic DatabaseError#871
mao-sz wants to merge 3 commits into
TheOdinProject:mainfrom
mao-sz:database-error

Conversation

@mao-sz

@mao-sz mao-sz commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Because

Currently, one of the startup checks is whether there are pending migrations to apply. This isn't the only database-related startup error though. Right now, if the connection string isn't accurate or postgresql.service isn't running, it still reports the pending migrations error.
dbmate status --exit-code returns 1 when connected but pending migrations, and 2 for db connection issues.

I do not know if postgresql.service and systemctl is different for different distros, or how it's handled on macOS (macOS guide doesn't mention anything about it), so I've left that error message more general for people to google if they run into it.

This PR

  • Renames PendingMigrationsError to the more generic DatabaseError
  • Ensures a relevant error message depending on the actual cause (both for the bot and for tests)

Issue

Closes #XXXXX

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Callbacks command: Update verbiage
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If this PR adds new features or functionality, I have added new tests
  • If applicable, I have ensured all tests related to any command files included in this PR pass, and/or all snapshots are up to date

@mao-sz
mao-sz requested review from a team and wise-king-sullyman and removed request for a team June 30, 2026 06:27
@mao-sz

mao-sz commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

When postgresql.service isn't running:
image

When service is running and connection string correct but pending migrations:
image

When postgresql.service isn't running and connection string wrong (when running Jest):
image

mao-sz added 2 commits June 30, 2026 07:50
Will make error more generic, since there are multiple Database issues that can occur
More than one potential database error - ensure error message is
relevant
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.

1 participant