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

[Enhancement]: Improve check for pending migration #2115

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

aybruhm
Copy link
Member

@aybruhm aybruhm commented Oct 11, 2024

Description

This PR refactors the check for pending migration handling process to improve efficiency and accuracy. Key changes include:

Changes Included

  • Updated the get_pending_migration_head function to compare only the latest migration head with the current state.
  • Enhanced the get_current_migration_head_from_db function to ensure it returns a single migration head, improving consistency.

What to QA

  • Migration Check (For First-time User):
    1. Delete all Docker resources related to Agenta on your PC.

    2. Run docker compose up --build to create new images, volumes, and containers.

    3. Apply the Alembic migration with this command:

      docker exec -w /app/agenta_backend/migrations/postgres agenta-backend-1 alembic -c alembic.oss.ini upgrade head
  • Migration Check (For Returning User):
    1. Run docker compose up --build to recreate the containers.

    2. Apply the Alembic migration with this command:

      docker exec -w /app/agenta_backend/migrations/postgres agenta-backend-1 alembic -c alembic.oss.ini upgrade head

Acceptance Tests

  • Verify that after applying the migrations, you do not receive a notification about pending migrations in the terminal.
  • Ensure to test for both OSS and cloud-dev environments.

NOTE: Cloud (prod) and OSS (prod) do not require QA as notifying users about pending migrations only happens locally.

…latest migration head

- Refactored the migration check to compare the current database migration head against the latest migration script head.
- Enhanced `get_current_migration_head_from_db` to ensure only one migration head is tracked.
- Updated logic in `get_pending_migration_head` to reduce unnecessary checks and handle first-time setup more efficiently.
- Improved error handling and clarified logging messages for better debugging.
Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
agenta ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 0:26am
agenta-documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 0:26am

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 11, 2024
@aybruhm aybruhm requested a review from jp-agenta October 11, 2024 07:45
@dosubot dosubot bot added the enhancement New feature or request label Oct 11, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 6, 2024
@aybruhm
Copy link
Member Author

aybruhm commented Nov 7, 2024

@jp-agenta let's not forget about this. 🫡

@jp-agenta jp-agenta merged commit c5f6fd9 into main Nov 7, 2024
11 checks passed
@jp-agenta jp-agenta deleted the enhancements/imporve-migration-check-handling branch November 7, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants