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 getDatabaseVersion & versioning tests #6597

Closed
wants to merge 1 commit into from

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Mar 13, 2016

Another small piece of the puzzle for improving migrations and getting test coverage.

The code to do with currentVersion was left over from before we ever did our first public release of Ghost, every subsequent migration has since set databaseVersion. We no longer support migrating from < 003, so we can safely ignore currentVersion if it still exists in the settings table.

PR #6596 (exporter cleanup & tests) made a change so that it's possible to test knex, and introduced a precedent of doing so - something I hadn't figured out when I started adding tests to cover versioning.js.

This PR brings coverage to 100% & also uses should-sinon to make the test assertions slightly neater.

refs #6301

  • currentVersion was leftover from before the first public release of Ghost!
  • simplified the code for getDatabaseVersion
  • improved & made consistent how errors are handled in getDatabaseVersion
  • migration error handling updated to reflect the changes in getDatabaseVersion
  • added tests for both getDatabaseVersion and setDatabaseVersion

refs TryGhost#6301

- `currentVersion` was leftover from before the first public release of Ghost!
- simplified the code for `getDatabaseVersion`
- improved & made consistent how errors are handled in `getDatabaseVersion`
- migration error handling updated to reflect the changes in `getDatabaseVersion`
- added tests for both `getDatabaseVersion` and `setDatabaseVersion`
@ErisDS
Copy link
Member Author

ErisDS commented Mar 14, 2016

closing temporarily whilst I remove should-sinon

@ErisDS ErisDS closed this Mar 14, 2016
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.

None yet

1 participant