Refactor PostgreSQL provider: multi-schema & async prep

- Refactor migrations and provider to use multiple PostgreSQL schemas, each matching a legacy SQLite database (activitylog, authentication, displaypreferences, library, users).
- All tables, foreign keys, and indexes are now schema-qualified; Down migration drops tables by schema.
- Provider ensures schemas exist before migrations; entities are mapped to correct schemas in OnModelCreating.
- Add support for max-pool-size, min-pool-size, and multiplexing connection options; update logging accordingly.
- VACUUM ANALYZE now runs per schema during scheduled optimization.
- TruncateAllTablesAsync now truncates tables with schema qualification.
- README updated with schema structure, new options, and multiplexing warnings.
- CacheDecorator now calls async repository methods using .GetAwaiter().GetResult(), with documentation.
- Lays groundwork for full async/await and multiplexing support in the database layer.
This commit is contained in:
2026-02-23 09:38:22 -05:00
parent ede6904433
commit 86883cd5c6
51 changed files with 6719 additions and 187 deletions
@@ -154,7 +154,9 @@ namespace MediaBrowser.Providers.MediaInfo
audio.HasLyrics = mediaStreams.Any(s => s.Type == MediaStreamType.Lyric);
_mediaStreamRepository.SaveMediaStreams(audio.Id, mediaStreams, cancellationToken);
await _mediaStreamRepository
.SaveMediaStreamsAsync(audio.Id, mediaStreams, cancellationToken)
.ConfigureAwait(false);
}
/// <summary>
@@ -138,7 +138,11 @@ namespace MediaBrowser.Providers.MediaInfo
}
// Try attachments first
var attachmentStream = _mediaSourceManager.GetMediaAttachments(item.Id)
var attachments = await _mediaSourceManager
.GetMediaAttachmentsAsync(item.Id, cancellationToken)
.ConfigureAwait(false);
var attachmentStream = attachments
.FirstOrDefault(attachment => !string.IsNullOrEmpty(attachment.FileName)
&& imageFileNames.Any(name => attachment.FileName.Contains(name, StringComparison.OrdinalIgnoreCase)));
@@ -278,9 +278,13 @@ namespace MediaBrowser.Providers.MediaInfo
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
_mediaStreamRepository.SaveMediaStreams(video.Id, mediaStreams, cancellationToken);
await _mediaStreamRepository
.SaveMediaStreamsAsync(video.Id, mediaStreams, cancellationToken)
.ConfigureAwait(false);
_mediaAttachmentRepository.SaveMediaAttachments(video.Id, mediaAttachments, cancellationToken);
await _mediaAttachmentRepository
.SaveMediaAttachmentsAsync(video.Id, mediaAttachments, cancellationToken)
.ConfigureAwait(false);
if (options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh
|| options.MetadataRefreshMode == MetadataRefreshMode.Default)