-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Improve migration #5391
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
feat: Improve migration #5391
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR improves database migrations by consolidating prompt-related functionality and fixing prompt length limits. The changes include three main components:
-
Model Updates: The
models.py
file introduces aPROMPT_LENGTH
constant set to 5,000,000 characters and updates thePersona
model'ssystem_prompt
andtask_prompt
fields to use this new limit, replacing the previous 8,000 character restriction. -
Schema Consolidation: The existing migration
abbfec3a5ac5_merge_prompt_into_persona.py
is significantly improved to merge the separateprompt
table into thepersona
table, eliminating complex many-to-many relationships. This migration removes defensive existence checks for a cleaner execution and migrates existing prompt data directly into persona records. -
Follow-up Migration: A new migration
b7ec9b5b505f_adjust_prompt_length.py
is added to specifically handle the prompt length adjustment from 8,000 to 5,000,000 characters in the persona table.
These changes align with simplifying the database architecture by removing unnecessary abstraction layers. Previously, personas could have multiple prompts through a junction table, but this complexity was eliminated since personas typically use a single prompt. The massive increase in prompt length (from 8K to 5M characters) enables support for much more detailed system instructions and complex AI prompts. The migrations work together to first consolidate the schema, then adjust the length limits to match the new model definitions.
Confidence score: 1/5
- This PR has critical issues that will cause migration failures and should not be merged without fixes
- Score reflects a serious table name bug in the new migration's downgrade function that references a non-existent table
- Pay close attention to
b7ec9b5b505f_adjust_prompt_length.py
which has incorrect table references in the downgrade function
3 files reviewed, 2 comments
op.drop_table("persona__prompt") | ||
|
||
# Step 6: Drop the prompt table (if it exists) | ||
if "prompt" in existing_tables: | ||
op.drop_table("prompt") | ||
op.drop_table("prompt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Tables may not exist in all environments - could cause migration failures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 3 files
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
Description
[Provide a brief description of the changes in this PR]
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.
Summary by cubic
Merge Prompt into Persona and raise prompt size limits to 5,000,000 characters. This simplifies the schema and supports very large prompts.
Migration
Refactors