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

Migrations #242

Closed
dtornow opened this issue Mar 11, 2024 · 1 comment · Fixed by #261
Closed

Migrations #242

dtornow opened this issue Mar 11, 2024 · 1 comment · Fixed by #261
Assignees
Labels
enhancement New feature or request

Comments

@dtornow
Copy link
Contributor

dtornow commented Mar 11, 2024

Describe the problem you are facing

During the deployment of new server versions, we often encounter the need to update our database schema to ensure compatibility with the latest features and improvements.

Describe the solution you'd like

I propose the implementation of a database migration system within our Resonate project. This system will manage and apply schema changes.

  • Introduce a migrations table to track the applied schema versions, as shown below:
CREATE TABLE IF NOT EXISTS migrations (
  id    INTEGER PRIMARY KEY
);

INSERT INTO migrations (id) VALUES (1);
  • On server startup, the Resonate server binary should query the migrations table for the highest id (representing the current database schema version).

  • If the server detects a discrepancy between the expected schema version and the current version in the database, the server should halt the startup process and prompt the user to apply the necessary migrations to align the schema versions.

@dtornow dtornow added the enhancement New feature or request label Mar 11, 2024
@dtornow
Copy link
Contributor Author

dtornow commented Mar 11, 2024

Implementing a migration system is not critical for the initial release but is essential for supporting future releases.

For 1.0-rc we only need to include the migrations table for Sqlite and Postgres, no code changes required

CREATE TABLE IF NOT EXISTS migrations (
  id    INTEGER PRIMARY KEY
);

INSERT INTO migrations (id) VALUES (1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants