Remove dead code: unused storage/transcoder members, Upload table, retry columns, redundant packages

This commit is contained in:
2026-09-24 05:19:59 +02:00
parent 0e3576922f
commit 5e819d7676
41 changed files with 1230 additions and 570 deletions
@@ -8,12 +8,11 @@ using Musify.Domain.ValueObjects;
using Musify.Infrastructure.Configuration;
using Musify.Infrastructure.MassTransit.Sagas;
using Npgsql;
using AppIDatabase = Musify.Application.Contracts.IDatabase;
namespace Musify.Infrastructure.Persistence;
public class Database(DatabaseConfiguration configuration)
: DbContext, AppIDatabase
: DbContext, Musify.Application.Contracts.IDatabase
{
private static readonly AuditableEntityInterceptor AuditInterceptor = new();
@@ -54,9 +53,6 @@ public class Database(DatabaseConfiguration configuration)
audio.Property(a => a.OriginalName).HasColumnName("OriginalAudioName").HasMaxLength(64);
audio.Property(a => a.FolderName).HasColumnName("AudioFolderName").HasMaxLength(64);
audio.Property(a => a.TranscodeStatus).HasColumnName("AudioTranscodeProcessingStatus");
audio.Property(a => a.DownloadRequested).HasColumnName("DownloadRequested");
audio.Property(a => a.RetryCount).HasColumnName("RetryCount");
audio.Property(a => a.LastRetryAt).HasColumnName("LastRetryAt");
});
modelBuilder.Entity<Track>().Navigation(track => track.Audio).IsRequired();
@@ -193,8 +189,6 @@ public class Database(DatabaseConfiguration configuration)
public DbSet<MixItem> MixItems => Set<MixItem>();
public DbSet<Upload> Uploads => Set<Upload>();
public DbSet<UploadIntent> UploadIntents => Set<UploadIntent>();
public DbSet<ListeningHistory> ListeningHistories => Set<ListeningHistory>();
@@ -1,4 +1,3 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
using Musify.Infrastructure.Configuration;
@@ -21,9 +20,6 @@ public class DatabaseDesignTimeFactory : IDesignTimeDbContextFactory<Database>
.Get<DatabaseConfiguration>()
?? throw new InvalidOperationException($"{DatabaseConfiguration.SectionName} configuration section not found.");
var optionsBuilder = new DbContextOptionsBuilder<Database>();
optionsBuilder.UseNpgsql(databaseConfiguration.ConnectionString);
return new Database(databaseConfiguration);
}
}
@@ -0,0 +1,70 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Musify.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class DropUploadTableAndTrackAudioRetryColumns : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Upload");
migrationBuilder.DropColumn(
name: "DownloadRequested",
table: "Tracks");
migrationBuilder.DropColumn(
name: "LastRetryAt",
table: "Tracks");
migrationBuilder.DropColumn(
name: "RetryCount",
table: "Tracks");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "DownloadRequested",
table: "Tracks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "LastRetryAt",
table: "Tracks",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "RetryCount",
table: "Tracks",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "Upload",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Bucket = table.Column<string>(type: "text", nullable: false),
ContentType = table.Column<string>(type: "text", nullable: false),
CreatedTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Key = table.Column<string>(type: "text", nullable: false),
State = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Upload", x => x.Id);
});
}
}
}
@@ -511,35 +511,6 @@ namespace Musify.Infrastructure.Persistence.Migrations
b.ToTable("TrackTags");
});
modelBuilder.Entity("Musify.Domain.Entities.Upload", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Bucket")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ContentType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreatedTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("text");
b.Property<int>("State")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Upload");
});
modelBuilder.Entity("Musify.Domain.Entities.UploadIntent", b =>
{
b.Property<Guid>("Id")
@@ -970,28 +941,16 @@ namespace Musify.Infrastructure.Persistence.Migrations
b1.Property<Guid>("TrackId")
.HasColumnType("uuid");
b1.Property<bool>("DownloadRequested")
.HasColumnType("boolean")
.HasColumnName("DownloadRequested");
b1.Property<string>("FolderName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("AudioFolderName");
b1.Property<DateTime?>("LastRetryAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("LastRetryAt");
b1.Property<string>("OriginalName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("OriginalAudioName");
b1.Property<int>("RetryCount")
.HasColumnType("integer")
.HasColumnName("RetryCount");
b1.Property<int>("TranscodeStatus")
.HasColumnType("integer")
.HasColumnName("AudioTranscodeProcessingStatus");