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

Database auto-upgrade #2059

Closed
vikman90 opened this issue Dec 10, 2018 · 0 comments
Closed

Database auto-upgrade #2059

vikman90 opened this issue Dec 10, 2018 · 0 comments
Assignees
Labels
module/db Wazuh DB engine

Comments

@vikman90
Copy link
Member

Main task Component
#1904 Wazuh DB

Issue #1904 introduces a change in the Wazuh DB schema for agents. These databases must be persistent from Wazuh v3.7.0. No newer version would be able to use a database with a schema version of 3.7.0.

That's why we need to implement an automatic upgrading procedure.

Brainstorming

  • SQLite allows deleting some columns from a table. It also allows appending a new column, but there is no way to alter the table's primary key. When we want to update a table, maybe we would have to:
    1. Rename the table.
    2. Create a new table that will replace the previous one.
    3. Copy every tuple from the old table to the new table.
    4. Drop the old table.
  • It's easier to implement a progressive update. For instance, if we want to upgrade from 3.7.0 to 3.9.0, we may make two steps:
    1. Upgrade from 3.7.0 to 3.8.0.
    2. Upgrade from 3.8.0 to 3.9.0.
  • Current databases have a table including the release version. I think it will be easier to include a DB version number —independent from the release version— to perform upgrades.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/db Wazuh DB engine
Projects
None yet
Development

No branches or pull requests

4 participants