Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Database migrations? #156

Closed
joel-u410 opened this issue Mar 4, 2024 · 3 comments
Closed

Database migrations? #156

joel-u410 opened this issue Mar 4, 2024 · 3 comments

Comments

@joel-u410
Copy link
Contributor

joel-u410 commented Mar 4, 2024

I noticed that #112 changed the database schema in a way that breaks compatibility with existing deployments.

What is the intended way to deal with things like this?

  1. Recreate database from scratch when there is a breaking change?
  2. Implement migrations that can upgrade a schema automatically?

Option 1 seems reasonable for now given the early stage of the namada network. However, long term you'll likely want to take approach 2. If/when there's a desire for that, I could potentially help with it.

@neithanmo
Copy link
Collaborator

@joel-u410

Thank you so much for highlighting the schema changes and your willingness to help with migrations. We've streamlined our database by consolidating transactions into a single table using JSON, leveraging PostgreSQL's native support. This change not only eases maintenance but also facilitates the migration processes(fewer tables to maintain). With the reduced complexity of our database layout and the integration of the SQLx Rust crate, which includes migration capabilities, we're now in a better position to implement database migrations. Your insight into the long-term benefits of option 2 is appreciated, and we're moving towards adopting this approach for future updates.

@satman81
Copy link

satman81 commented Mar 8, 2024

what's the correct way to update to #112 ? do we drop the the db and it will be created automaticaly (in that case it will sync from scratch) or any alternative to keep the existing synced data?

Thanks.

@joel-u410

Thank you so much for highlighting the schema changes and your willingness to help with migrations. We've streamlined our database by consolidating transactions into a single table using JSON, leveraging PostgreSQL's native support. This change not only eases maintenance but also facilitates the migration processes(fewer tables to maintain). With the reduced complexity of our database layout and the integration of the SQLx Rust crate, which includes migration capabilities, we're now in a better position to implement database migrations. Your insight into the long-term benefits of option 2 is appreciated, and we're moving towards adopting this approach for future updates.

@rllola
Copy link
Contributor

rllola commented Mar 19, 2024

what's the correct way to update to #112 ? do we drop the the db and it will be created automaticaly (in that case it will sync from scratch) or any alternative to keep the existing synced data?

Thanks.

Yes the best way is to drop the database and re-index. (sorry for the late answer)

@rllola rllola closed this as completed Mar 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants