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

Refactor StoreService, StoreCacheService and ProjectService to have a single source of truth #2269

Open
stwiname opened this issue Feb 25, 2024 · 0 comments

Comments

@stwiname
Copy link
Collaborator

Description

With migrations now supported there are multiple places where we keep references to the current models. They are updated at different times and in different places. This has led to entangling of some dependencies on other services.

This should be refactored to simplify the code and reduce chances of bugs.

There are currently 3 places where the current models/schema are needed:

  • StoreCacheService to provide CachedModels in the store
  • StoreService sequelize hooks to use the right block height when querying/updating data
  • StoreService _modelIndexedFields and _modelsRelations for POI and store methods

Solution

When a migration is run it should return all the required information (sequelize models, gql schema) to update the necessary places. This should remove the need for the SchemaMigraionService and Migration to depend on the StoreService.

There should be a new method on the StoreService that is called after a migration that updates everything correctly and this should be the only way to set fields that depend on the current models/schema

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

No branches or pull requests

1 participant