Joystream / Joystream/joystream

QN: Deletion of an app will fail if there are already videos/channels associated with the app

Open
#4,661 6 comments 0 reactions 1 assignee Claimed by @WRadoslaw View on GitHub
apps bug query-node
Dominant language
Rust
Stars
1.4k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

There's no easy way to set things like `ON DELETE CASCADE` or `ON DELETE SET NULL` currently in QN, so deletion of any entity will fail (crash the QN) if there are already other entities that reference it.

**The problem:** We introduced deletion for the apps, but later we introduced `Video.entryApp` and `Channel.entryApp` relations. Now when we're deleting the app we're not checking if any videos/channels reference it (https://github.com/Joystream/joystream/blob/apps-metaprotocol/query-node/mappings/src/content/app.ts#L102), which introduces a possibly to break the QN.

**Solutions:**
- Disallow app deletion
- Don't drop the actual entity when an app is deleted (for example: just set `isDeleted` to `true)
- Query videos and channels that reference the app and unset the relations manually (could become expensive once there are a lot of videos/channels referencing the app)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.