Skip to content

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

Open

Description

@stwiname

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy