mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Replicated changes made from #13492
This commit is contained in:
parent
05f5d19ff4
commit
a6b4d124d7
@ -27,6 +27,12 @@ public interface IJellyfinDatabaseProvider
|
|||||||
/// <param name="modelBuilder">The ModelBuilder from EFCore.</param>
|
/// <param name="modelBuilder">The ModelBuilder from EFCore.</param>
|
||||||
void OnModelCreating(ModelBuilder modelBuilder);
|
void OnModelCreating(ModelBuilder modelBuilder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will be invoked when EFCore wants to configure its model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="configurationBuilder">The ModelConfigurationBuilder from EFCore.</param>
|
||||||
|
void ConfigureConventions(ModelConfigurationBuilder configurationBuilder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If supported this should run any periodic maintaince tasks.
|
/// If supported this should run any periodic maintaince tasks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -272,4 +272,11 @@ public class JellyfinDbContext(DbContextOptions<JellyfinDbContext> options, ILog
|
|||||||
// Configuration for each entity is in its own class inside 'ModelConfiguration'.
|
// Configuration for each entity is in its own class inside 'ModelConfiguration'.
|
||||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(JellyfinDbContext).Assembly);
|
modelBuilder.ApplyConfigurationsFromAssembly(typeof(JellyfinDbContext).Assembly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||||
|
{
|
||||||
|
jellyfinDatabaseProvider.ConfigureConventions(configurationBuilder);
|
||||||
|
base.ConfigureConventions(configurationBuilder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||||
|
|
||||||
|
namespace Jellyfin.Database.Providers.SqLite;
|
||||||
|
|
||||||
|
internal class DoNotUseReturningClauseConvention : IModelFinalizingConvention
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void ProcessModelFinalizing(
|
||||||
|
IConventionModelBuilder modelBuilder,
|
||||||
|
IConventionContext<IConventionModelBuilder> context)
|
||||||
|
{
|
||||||
|
foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
|
||||||
|
{
|
||||||
|
entityType.UseSqlReturningClause(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -78,4 +78,10 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
|
|||||||
|
|
||||||
SqliteConnection.ClearAllPools();
|
SqliteConnection.ClearAllPools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||||
|
{
|
||||||
|
configurationBuilder.Conventions.Add(_ => new DoNotUseReturningClauseConvention());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user