Fix catalog timestamp column compatibility#4
Closed
cursor[bot] wants to merge 1 commit into
Closed
Conversation
Co-authored-by: Bruno Medeiros <bruno.do.medeiros@gmail.com>
Owner
|
Not applicable, application is not deployed yet so there is not database to migrate. Breaking changes are okay at this point. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
Recent timestamp changes edited the existing catalog migration from
TIMESTAMPTZtoTIMESTAMPand changed repository mapping toNaiveDateTime. Databases that had already applied the original migration keepTIMESTAMPTZcolumns, so after deploying the new code catalog reads, lists, creates, and updates can fail with sqlx/Postgres type errors instead of serving data.Root cause
The checked-in migration was mutated after it had already defined timezone-aware timestamp columns, while the repository was updated to bind/decode timezone-less timestamps. That made the application binary incompatible with already-migrated databases.
Fix
Restore the migration schema contract to
TIMESTAMPTZand restore repository binding/row mapping tochrono::DateTime<Utc>.Validation
rustfmt --edition 2021 catalog-svc/catalog-svc/src/catalog/repository.rsgit diff --check./gradlew buildto generate missing Smithy projectionsCC=gcc CXX=g++ ./catalog-svc/generate-openapi.shto generate missing OpenAPI input for the client buildCC=gcc CXX=g++ cargo test -p catalog-svc --lib --binspassesDatabase integration validation note:
CC=gcc CXX=g++ cargo test -p catalog-svccompiles and runs non-DB targets, thentests/catalog_crud.rsfails withPoolTimedOutbecause no PostgreSQL service is running in this VM. Attempting to start the repo's compose stack was blocked bydocker: command not found.