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

Issue #378: Add alembic support for database migrations #387

Draft
wants to merge 98 commits into
base: master
Choose a base branch
from

Conversation

baileythegreen
Copy link
Contributor

@baileythegreen baileythegreen commented Mar 28, 2022

This PR adds alembic for pyani, making it possible to upgrade and downgrade existing databases to accommodate otherwise breaking changes to the ORM, as with the addition of fastANI capabilities.

Closes #378.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • This change requires a documentation update
  • This is a documentation update

Action Checklist

  • Work on a single issue/concept (if there are multiple separate issues to address, please use a separate pull request for each)
  • Fork the pyani repository under your own account (please allow write access for repository maintainers)
  • Set up an appropriate development environment (please see CONTRIBUTING.md)
  • Create a new branch with a short, descriptive name
  • Work on this branch
    • style guidelines have been followed
    • new code is commented, especially in hard-to-understand areas
    • corresponding changes to documentation have been made
    • tests for the change have been added that demonstrate the fix or feature works
  • Test locally with pytest -v non-passing code will not be merged
  • Rebase against origin/master
  • Check changes with flake8 and black before submission
  • Commit branch
  • Submit pull request, describing the content and intent of the pull request
  • Request a code review
  • Continue the discussion at Pull requests section in the pyani repository

@codecov
Copy link

codecov bot commented Mar 28, 2022

Codecov Report

Merging #387 (582bdc4) into master (62949c4) will decrease coverage by 0.53%.
The diff coverage is 63.95%.

@@            Coverage Diff             @@
##           master     #387      +/-   ##
==========================================
- Coverage   75.82%   75.28%   -0.54%     
==========================================
  Files          55       58       +3     
  Lines        3747     3917     +170     
==========================================
+ Hits         2841     2949     +108     
- Misses        906      968      +62     

@baileythegreen
Copy link
Contributor Author

This PR is still missing tests for the --dry-run option and some investigation is needed to ensure it works as expected in a non-development environment (where pyani versiondb would not be called from a dev pyani directory, and so the requisite alembic config files would be located elsewhere.

@baileythegreen
Copy link
Contributor Author

In the interest of having the database migration functionality merged sooner, I would suggest that tests for the --dry-run option here be made a separate issue. The --dry-run option is neither the main purpose of this issue, nor does the migration capability hinge upon the --dry-run working correctly.

@baileythegreen baileythegreen added this to the 0.3.0 milestone May 4, 2022
@baileythegreen baileythegreen added the enhancement something we'd like pyani to do that it doesn't already label May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement something we'd like pyani to do that it doesn't already
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use alembic to manage SQLite schema changes?
1 participant