[DB] Update migrations for datetime update

This commit is contained in:
max
2025-09-02 16:17:47 +02:00
parent d98a99d145
commit a8b0291ebf
7 changed files with 58 additions and 11 deletions

View File

@@ -31,6 +31,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Library\" />
<Folder Include="Logs\Debug\" />
</ItemGroup>

View File

@@ -8,21 +8,26 @@ namespace Manager.App.Services.System;
public class ClientManager : BackgroundService
{
private readonly List<YouTubeClient> _clients = [];
private bool _cancelled;
private CancellationToken _cancellationToken;
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_cancellationToken = stoppingToken;
stoppingToken.Register(CancellationRequested);
}
private void CancellationRequested()
{
_cancelled = true;
// Clear up
}
public async Task<Result<YouTubeClient>> LoadClient(ClientAccountEntity accountEntity)
{
if (_cancellationToken.IsCancellationRequested)
{
return ResultError.Fail("Service is shutting down.");
}
var container = new CookieContainer();
if (accountEntity.HttpCookies.Count != 0)

View File

@@ -0,0 +1,12 @@
namespace Manager.App.Services.System;
public class SystemService : BackgroundService
{
private CancellationToken _cancellationToken { get; set; }
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_cancellationToken = stoppingToken;
}
}

View File

@@ -11,6 +11,7 @@ public sealed class LibraryDbContext : DbContext
{
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
ChangeTracker.LazyLoadingEnabled = false;
Database.EnsureCreated();
}
public DbSet<CaptionEntity> Captions { get; set; }

View File

@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Manager.Data.Migrations
{
[DbContext(typeof(LibraryDbContext))]
[Migration("20250902133345_InitialLibrary")]
[Migration("20250902141251_InitialLibrary")]
partial class InitialLibrary
{
/// <inheritdoc />
@@ -30,6 +30,12 @@ namespace Manager.Data.Migrations
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
@@ -157,10 +163,10 @@ namespace Manager.Data.Migrations
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<DateTime>("DateAddedUtc")
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<DateTime>("DateModifiedUtc")
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.HasKey("PlaylistId", "MediaId");
@@ -242,6 +248,9 @@ namespace Manager.Data.Migrations
b.Property<long>("ContentLengthBytes")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<double?>("Framerate")
.HasColumnType("REAL");
@@ -254,6 +263,9 @@ namespace Manager.Data.Migrations
b.Property<long>("LastModifiedUnixEpoch")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.Property<double?>("LoudnessDb")
.HasColumnType("REAL");

View File

@@ -131,7 +131,9 @@ namespace Manager.Data.Migrations
{
MediaId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
LanguageCode = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false)
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
LastModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
@@ -164,7 +166,9 @@ namespace Manager.Data.Migrations
QualityLabel = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
AudioChannels = table.Column<int>(type: "INTEGER", nullable: true),
AudioSampleRate = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
LoudnessDb = table.Column<double>(type: "REAL", nullable: true)
LoudnessDb = table.Column<double>(type: "REAL", nullable: true),
CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
LastModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
@@ -183,8 +187,8 @@ namespace Manager.Data.Migrations
{
PlaylistId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
MediaId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
DateAddedUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
DateModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
LastModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{

View File

@@ -27,6 +27,12 @@ namespace Manager.Data.Migrations
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
@@ -154,10 +160,10 @@ namespace Manager.Data.Migrations
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<DateTime>("DateAddedUtc")
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<DateTime>("DateModifiedUtc")
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.HasKey("PlaylistId", "MediaId");
@@ -239,6 +245,9 @@ namespace Manager.Data.Migrations
b.Property<long>("ContentLengthBytes")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<double?>("Framerate")
.HasColumnType("REAL");
@@ -251,6 +260,9 @@ namespace Manager.Data.Migrations
b.Property<long>("LastModifiedUnixEpoch")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.Property<double?>("LoudnessDb")
.HasColumnType("REAL");