lablup / lablup/backend.ai

Add missing foreign key constraints to RBAC tables

Open
#9,413 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

Several RBAC tables are missing foreign key constraints, allowing orphan rows when referenced entities are deleted.

Add FK constraints via Alembic migration:

- permissions.role_id → roles.id (CASCADE DELETE)
- user_roles.user_id → users.uuid (CASCADE DELETE)
- user_roles.role_id → roles.id (CASCADE DELETE)

These FKs were lost when migration f41bbe0c0f12 dropped the permission_groups table without re-adding them to the new tables.

JIRA Issue: BA-4736

Contributor guide

Open the contributing guide

Research direction

Review migration f41bbe0c0f12 and the current Alembic migration conventions for the RBAC tables. Verify the permissions and user_roles relationships against roles and users, then confirm that the migration adds all three requested foreign keys with CASCADE DELETE and prevents orphan rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.