Skip to content

[Refactor] Update database schema for series cast#239

Merged
Divinelink merged 3 commits intomainfrom
feature/update-credits-database-schema
Feb 1, 2026
Merged

[Refactor] Update database schema for series cast#239
Divinelink merged 3 commits intomainfrom
feature/update-credits-database-schema

Conversation

@Divinelink
Copy link
Owner

@Divinelink Divinelink commented Feb 1, 2026

Summary

This pull request essentially updates the database schema for series cast information.

The initial implementation was not scalable and it made it impossible to add cast information for other credit types like season guest stars, episode guest stars etc without adding multiple tables with redundant information. This would create performance and storage issues.

We updated the related schema in order to store basic person information and person roles in separate tables.

CREATE TABLE PersonEntity(
  id INTEGER PRIMARY KEY NOT NULL,
  name TEXT NOT NULL,
  originalName TEXT NOT NULL,
  profilePath TEXT,
  knownForDepartment TEXT,
  gender INTEGER NOT NULL
);
CREATE TABLE PersonRoleEntity(
  creditId TEXT PRIMARY KEY NOT NULL,
  character TEXT NOT NULL,
  castId INTEGER NOT NULL REFERENCES PersonEntity(id)
);
CREATE TABLE ShowCastRoleEntity(
  showId INTEGER NOT NULL,
  creditId TEXT NOT NULL REFERENCES PersonRoleEntity(creditId),
  episodeCount INTEGER NOT NULL,
  creditOrder INTEGER NOT NULL,
  PRIMARY KEY (showId, creditId)
);

With this change, person and role data stored once and referenced while it's easy to add new credit types by creating new association tables.

@Divinelink Divinelink self-assigned this Feb 1, 2026
@Divinelink Divinelink added enhancement New feature or request refactor labels Feb 1, 2026
@Divinelink Divinelink merged commit 1b6ba0d into main Feb 1, 2026
2 checks passed
@Divinelink Divinelink deleted the feature/update-credits-database-schema branch February 1, 2026 19:01
@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

❌ Patch coverage is 97.26027% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.30%. Comparing base (175a268) to head (d37e858).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ata/details/mapper/AggregateCreditsEntityMapper.kt 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
- Coverage   79.33%   79.30%   -0.04%     
==========================================
  Files         721      717       -4     
  Lines       19702    19678      -24     
  Branches     2187     2187              
==========================================
- Hits        15631    15605      -26     
- Misses       3142     3143       +1     
- Partials      929      930       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant