lablup / lablup/backend.ai

Ease deletion of objects referred by many different entities

Open
#7,176 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Motivation

**Projects** and **resource groups** have many incoming (foreign key) references from `users`, `sessions`, etc. tables, preventing them from being deleted easily.

## Objective

- Make constraint violation errors to be displayed with a more human-friendly error messages (“why you cannot delete this”).
- Make it easier to delete such “complex” objects. Potential ideas:
- Replace incoming foreign-key references in other tables with “ghost” entities (as first proposed in [https://lablup.atlassian.net/browse/BA-110](https://lablup.atlassian.net/browse/BA-110)) while keeping the FK constraints as-is.
- Remove most FK constraints in the database schema, and handle NULL references gracefully in the Python-side logic.
- Ensure recording audit logs for any destructive actions like complex object deletion

> **The overall direction of design:** Don’t remove database records unless they reach _the history retention limit_, but put them in “DELETED” state to filter from normal API queries. Still, the same motivation and argument applies when we actually purge the objects when they reach the retention limit.

## Expected Sub Issue

- (TODO)

JIRA Issue: BA-3287

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.