Closed Gaisberg closed 2 weeks ago
[!CAUTION]
Review failed
The pull request is closed.
This pull request introduces significant enhancements to the database migration system using Alembic for a media management application. Key changes include the addition of a new Alembic configuration file, the establishment of a baseline database schema, and the implementation of improved logging and error handling mechanisms. New functions for resetting the database and managing migrations have been added, while redundant code has been removed to streamline the migration process. Additionally, command-line interface updates allow for pre-migration database resets, enhancing user control over database management.
File | Change Summary |
---|---|
src/alembic.ini |
New configuration file for Alembic with parameters like script_location , file_template , etc. |
src/alembic/env.py |
Added logging with Loguru, new functions for database reset and migration handling. |
src/alembic/script.py.mako |
New Mako template for Alembic migration scripts with placeholders for dynamic content. |
src/alembic/versions/20241105_1300_c99709e3648f_baseline_schema.py |
New migration script establishing baseline schema with multiple tables and relationships. |
src/program/db/db.py |
Removed redundant Alembic management code, simplified migration execution logic. |
src/program/db/db_functions.py |
Enhanced database reset functionality, added new method for pre-migration reset. |
src/program/settings/models.py |
Added new boolean attribute debug_database to AppModel class. |
src/program/utils/cli.py |
Introduced new CLI argument --hard_reset_db_pre_migration for pre-migration database reset. |
🐇 In the burrow where data flows,
Alembic dances, as the schema grows.
With logs that sparkle, errors that fade,
A reset before migration, a fine upgrade.
Hopping through tables, oh what a sight,
In the world of databases, all feels right! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Looks good man - great work We can prob get rid of that README file
@dreulavelle I'm having a crash loop now on startup when upgrading from 0.16.2 to 0.17.0
riven | alembic.util.exc.CommandError: Can't locate revision identified by '97cbe84f0c18'
riven | 24-11-05 19:12:00 | CRITICAL | main.
Please run the following command: docker exec -it ”riven_container_name” python /riven/src/main.py —hard_reset_db_pre_migration
For reference when running in compose and crashlooping as I was:
docker compose run --entrypoint python riven /riven/src/main.py --hard_reset_db_pre_migration
docker compose run --entrypoint python riven /riven/src/main.py --hard_reset_db_pre_migration
This should be really added to release notes! @dreulavelle
Pull Request Check List
Resolves: #issue-number-here
Description:
Summary by CodeRabbit
Release Notes
New Features
--hard_reset_db_pre_migration
for pre-migration database resets.debug_database
in application settings.Enhancements
Bug Fixes
These updates enhance the database management capabilities and streamline migration processes, providing users with better control and diagnostics.