-
Notifications
You must be signed in to change notification settings - Fork 164
epic: Cortex Updater can migrate data structure changes #1184
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
Comments
Some thoughts on data migration:
CREATE TABLE IF NOT EXISTS schema_version (
version INTEGER NOT NULL
);
Question: should we use migration scripts or implement a C++ database migration component? What do you think? @dan-homebrew @louis-jan @janhq/cortex |
@vansangpfiev Overall, I think we should do what allows us to ship something quickly this Friday. Up/Down Migrations
Please push back on this @janhq/cortex - as you can tell from the RoR reference, my approach may be very outdated. Database migration strategy
Cortex Data Structure
|
We likely need to design for both local running and cloud deployment. Adding a code constraint would block our migration from the deployment layer, which likely waits for an instance to spin up and perform a health check, which is inefficient. There could also be a scenario where we want to share the database instance across services like cortex.py and cortex.cpp. However, one advantage is that they can embed cortex.cpp as a standalone binary without having to worry about other services, which is particularly useful when I’d prefer built-in migrations as suggested above for cortex.cpp to ensure embedding in Jan won’t cause issues. |
We will use SQL scripts for up/down migrations, try to minimize changes between versions to ensure smooth transitions. For complex down migrations, we will create a PR to address any issues.
Structure
Question: How do we ship the migration scripts?
cc: @dan-homebrew @hiento09 @janhq/cortex |
@vansangpfiev Our discussion:
|
Oops. This wouldn’t work for nightly migration support or switching between commits. |
Hmm, can we solve this via running migrations manually for Nightly? Nightly
Switching between commits
|
@dan-homebrew IMO, It is necessary to distinguish between the data version and the software version. Since all migration actions occur within the software, the application may not know its current version during modifications (can be stable, beta, nightly, etc). To ensure clarity and consistency, we can increment the data version each time a change is made. In the event of a conflict, we will revert to the previous version of the data. This separation allows for more effective management of both software and data changes, enhancing stability and reliability throughout the migration process. |
TL, DR: If we roll back to a specific commit |
Expected result:
|
@TC117 Please close this ticket once QA sign off and completed |
Goal
Scope
.cortexrc
)Discussion
Success Criteria:
Tasklist
The text was updated successfully, but these errors were encountered: