Repository navigation
Adding cache schema version - #1204
Conversation
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
|
#1189 made changes to the schema, so this may need to change to account for that |
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
6f12892 to
ce7a917
Compare
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
There was a problem hiding this comment.
Love the change in this file to unify our connection strings! this will be a great place to pivot to storing the cache db somewhere more persistent/in the same postgres instance
| # Reconcile indexes after migrations so they reflect the final schema. | ||
| _ensure_repo_id_indexes() |
There was a problem hiding this comment.
we can version the indexes alongside the schema if we were using sqlalchemy for our data models
Replace the historical labels migration with a data-preserving baseline and generate numeric Alembic revisions. Resolve migration paths relative to the config and use snapshot-free advisory-lock polling. Add PostgreSQL regression checks for baseline adoption, future upgrades, revision generation, and lock cleanup. Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
|
@EngCaioFonseca @MoralCode LMK when this PR is ready to be tested |
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
cdolfi
left a comment
There was a problem hiding this comment.
Something in this pr is making Contribution File Heatmap endlessly load, tested dev and did not see the same behavior
Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
Resolved. It was necessary to ensure that the app and workers wait for the db-init to finish successfully and no redis flush before this. |
Pull Request Change Description
This solves #1198 and adds the cache schema versioning as well as lay the groundwork for the follow up steps or making the cache persistent.
The cache schema is now versioned with Alembic. It runs on startup: a fresh cache gets stamped at the latest version, and an existing cache gets any missing migrations applied automatically. Base tables are still created with the raw CREATE blocks in db_init.py, so adding a new table works exactly like before. Alembic only handles changes to existing tables.
A few things added for the cache long-term:
This is also groundwork for making the cache persistent instead of rebuilt on every boot.
Generative AI disclosure
Please select one option:
If AI tools were used, please provide details below:
- What tools were used? Claude - Opus 4.8; GPT - 5.6 Sol
- How were these tools used? Draft, review iteration.
- Did you review these outputs before submitting this PR? Yes.