DIRACGrid / DIRACGrid/diracx

RSS DB: schema changes

Open
#896 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
19
Forks
45
Avg merge
4d 23h
Merged PRs (30d)
12

Description

### User Story

As a diracx developer, I want the RSS database to be streamlined once DIRAC-diracX transition is complete.

### Feature Description

The RSS tables currently use the magic string `"all"` as a server default for
the VO and StatusType columns. This convention was inherited from DIRAC's schema
and must be preserved during the transition because DIRAC reads/writes the same
tables.

After the transition, we should:
1. Add an Alembic migration replacing `"all"` with `NULL` in existing rows
2. Change the column `server_default` from `"all"` to `None`
3. Update query logic to treat `NULL` as "applies to all"
4. Review whether the `ElementStatusBase` / `ElementStatusBaseWithID` dual-class hierarchy is still needed ([schema.py L24–71](https://github.com/DIRACGrid/diracx/blob/4c7853ab21bfc8cb9c83583a457458a5b132c0bd/diracx-db/src/diracx/db/sql/rss/schema.py#L24-L71)). DIRAC uses both composite-PK tables and autoincrement-ID tables; after the transition we may be able to consolidate into a single base class.

Context from PR #857:
- https://github.com/DIRACGrid/diracx/pull/857#discussion_r3059282739
- https://github.com/DIRACGrid/diracx/pull/857#discussion_r3059297589

See whether we still need: https://github.com/DIRACGrid/diracx/blob/4c7853ab21bfc8cb9c83583a457458a5b132c0bd/diracx-db/src/diracx/db/sql/rss/schema.py#L24-L71

### Definition of Done

- [ ] Alembic migration converts existing `"all"` values to `NULL`
- [ ] Column defaults updated in SQLAlchemy schema
- [ ] Query logic handles `NULL` semantics
- [ ] `ElementStatusBase` / `ElementStatusBaseWithID` hierarchy reviewed and simplified if possible
- [ ] Tests are written and passing

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.