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

Alembic-managed schema migrations for postgis driver. (cleaned up git history) #1520

Merged
merged 15 commits into from
Dec 19, 2023

Conversation

SpacemanPaul
Copy link
Contributor

@SpacemanPaul SpacemanPaul commented Dec 6, 2023

Reason for this pull request

The database schema for the postgres database has been frozen for years because making schema changes requires manually writing code to check whether an update is required and applying said update.

Alembic is a schema migration framework for SQLAlchemy that automates much of this.

Proposed changes

  • datacube system init for the postgis index driver now uses Alembic to detect what schema upgrades are required and apply them.
  • Developer documentation on how to handle schema upgrades in future.

N.B. Some remaining coverage gaps that can't really be filled until we have some actual migrations lined up.

  • Tests added / passed
  • Fully documented, including docs/about/whats_new.rst for all changes

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 47 lines in your changes are missing coverage. Please review.

Comparison is base (5be0e6e) 85.37% compared to head (bd72270) 85.16%.

Files Patch % Lines
datacube/drivers/postgis/alembic/env.py 42.18% 37 Missing ⚠️
datacube/drivers/postgis/_core.py 70.37% 8 Missing ⚠️
.../alembic/versions/48fb71ece268_initial_revision.py 80.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           develop-1.9    #1520      +/-   ##
===============================================
- Coverage        85.37%   85.16%   -0.22%     
===============================================
  Files              137      139       +2     
  Lines            14784    14895     +111     
===============================================
+ Hits             12622    12685      +63     
- Misses            2162     2210      +48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SpacemanPaul SpacemanPaul marked this pull request as ready for review December 6, 2023 22:52
@SpacemanPaul SpacemanPaul requested review from omad and Ariana-B December 7, 2023 23:27
@SpacemanPaul SpacemanPaul merged commit 9e31d17 into develop-1.9 Dec 19, 2023
28 checks passed
@SpacemanPaul SpacemanPaul deleted the postgis-migrations branch December 19, 2023 03:40
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