-
Notifications
You must be signed in to change notification settings - Fork 193
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
Migration of models when schema changes #2088
Comments
@glihm , I'd love to have more details on what's expected here |
For sure, the thing is that in Dojo, Torii (the indexer) is reading information from the world that is on-chain by gathering events. Once the events are gathered, Torii keeps data in its own database. Currently, it's a SQLite database. So when a model is registered, it has a pre-defined layout (members of the string, and the types for each of them). And currently, if you change the type of a member inside a model, Torii doesn't support to actually migrate the data to support the new type. However, some types changes may be totally transparent. If you have a struct MyModel {
#[key]
player: ContractAddress,
data: u8,
} Ideally, Torii should support migrating to:
So we may have a first iteration where only simple types are supported. The models are registered here: dojo/crates/torii/core/src/sql.rs Line 97 in b04c0d7
|
Thanks for this info, can I hop on this? @glihm |
Hi @glihm, This query handles it:
So when a However, the contract_address will change if a new address is passed down the function during the migration (which I think is a drawback) So I want to be sure I'm on the right track. If I am, then I seek your permission not to allow contract_address to change whenever the UPDATE part of the query is called upon Let me know if I'm on the right track or not |
Sorry for the delay here. Currently there's a wip by @Larkooo to integrate the namespaces into Torii (PR will be open against the Does it make sense to you? |
Yea... This makes total sense now... Final questions
|
Sorry for the delay here, how are you doing on that?
The tag is now
The namespace is a placeholder yeah. 👍 |
@zarah-s any update on your end? |
Currently, Torii doesn't support model changes in the database.
However, model changes are now backward compatible at the storage level in
dojo-core
, and a game developer may change a model during the lifetime of a game.What's Torii needs is at first a simple strategy that is defined from the schema changes of the model, in order to update the tables in the database as necessary.
The text was updated successfully, but these errors were encountered: