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

Support multiple Relationships with same input name #131

Closed
maaft opened this issue Dec 25, 2024 · 3 comments
Closed

Support multiple Relationships with same input name #131

maaft opened this issue Dec 25, 2024 · 3 comments

Comments

@maaft
Copy link
Contributor

maaft commented Dec 25, 2024

Currently you cannot add multiple relationships that have the same input name. Example:

rindexer.yaml

relationships: 
      - contract_name: LensGame
        event_name: GameCreated
        event_input_name: "gameId"
        linked_to: 
          - contract_name: LensGame
            event_name: PlayerJoined
            event_input_name: gameId
          - contract_name: LensGame
            event_name: GameStarted
            event_input_name: gameId
          - contract_name: LensGame
            event_name: GameStateChanged
            event_input_name: gameId

This leads to duplication errors in postgres:

INFO Applied foreign key for relationship after historic resync complete: table - lensgameindexer_lens_game.game_created constraint - fk_player_joined_game_id
21 December - 14:49:14.779469  INFO Applied index for relationship after historic resync complete: table - lensgameindexer_lens_game.game_created index - idx_game_created_game_id
21 December - 14:49:14.784115  INFO Applied unique constraint key for relationship after historic resync complete: table - lensgameindexer_lens_game.game_started constraint - unique_game_started_game_id
21 December - 14:49:14.786004  INFO Applied foreign key for relationship after historic resync complete: table - lensgameindexer_lens_game.game_created constraint - fk_game_started_game_id
Error starting the server: Could not apply relationship - PgError db error: ERROR: relation "idx_game_created_game_id" already exists

We need a way to:
a. either rename these relationships in yaml
b. automatically support renaming of duplicate indices / relationships

I think that a) would be preferable, since it would also allow us to specify custom names of the graphql relationship. This would make the API more readable in cases where event-input-name is not a good indicator for the name of the relationship.

@joshstevens19
Copy link
Owner

Will fix this for now and long term solution is #28

@joshstevens19
Copy link
Owner

fixes - a5198dc

@joshstevens19
Copy link
Owner

version rindexer - 0.11.3 has fix

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

2 participants