mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Store original filename on import.
This commit is contained in:
@@ -283,15 +283,16 @@ namespace RomRepoMgr.Core.Workers
|
||||
|
||||
dbFile = new DbFile
|
||||
{
|
||||
Crc32 = checksums[ChecksumType.Crc32],
|
||||
Md5 = checksums[ChecksumType.Md5],
|
||||
Sha1 = checksums[ChecksumType.Sha1],
|
||||
Sha256 = checksums[ChecksumType.Sha256],
|
||||
Sha384 = checksums[ChecksumType.Sha384],
|
||||
Sha512 = checksums[ChecksumType.Sha512],
|
||||
Size = uSize,
|
||||
CreatedOn = DateTime.UtcNow,
|
||||
UpdatedOn = DateTime.UtcNow
|
||||
Crc32 = checksums[ChecksumType.Crc32],
|
||||
Md5 = checksums[ChecksumType.Md5],
|
||||
Sha1 = checksums[ChecksumType.Sha1],
|
||||
Sha256 = checksums[ChecksumType.Sha256],
|
||||
Sha384 = checksums[ChecksumType.Sha384],
|
||||
Sha512 = checksums[ChecksumType.Sha512],
|
||||
Size = uSize,
|
||||
CreatedOn = DateTime.UtcNow,
|
||||
UpdatedOn = DateTime.UtcNow,
|
||||
OriginalFileName = Path.GetFileName(path)
|
||||
};
|
||||
|
||||
fileInDb = false;
|
||||
|
||||
229
RomRepoMgr.Database/Migrations/20200904000432_AddOriginalFilenameField.Designer.cs
generated
Normal file
229
RomRepoMgr.Database/Migrations/20200904000432_AddOriginalFilenameField.Designer.cs
generated
Normal file
@@ -0,0 +1,229 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using RomRepoMgr.Database;
|
||||
|
||||
namespace RomRepoMgr.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(Context))]
|
||||
[Migration("20200904000432_AddOriginalFilenameField")]
|
||||
partial class AddOriginalFilenameField
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.7");
|
||||
|
||||
modelBuilder.Entity("RomRepoMgr.Database.Models.DbFile", b =>
|
||||
{
|
||||
b.Property<ulong>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Crc32")
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(8);
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsInRepo")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Md5")
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(32);
|
||||
|
||||
b.Property<string>("OriginalFileName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Sha1")
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.Property<string>("Sha256")
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(64);
|
||||
|
||||
b.Property<string>("Sha384")
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(96);
|
||||
|
||||
b.Property<string>("Sha512")
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(128);
|
||||
|
||||
b.Property<ulong>("Size")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Crc32");
|
||||
|
||||
b.HasIndex("Sha1");
|
||||
|
||||
b.HasIndex("Sha256");
|
||||
|
||||
b.HasIndex("Sha384");
|
||||
|
||||
b.HasIndex("Sha512");
|
||||
|
||||
b.HasIndex("Size");
|
||||
|
||||
b.ToTable("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RomRepoMgr.Database.Models.FileByMachine", b =>
|
||||
{
|
||||
b.Property<ulong>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<ulong>("FileId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<ulong>("MachineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FileId");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.ToTable("FilesByMachines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RomRepoMgr.Database.Models.Machine", b =>
|
||||
{
|
||||
b.Property<ulong>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("RomSetId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("RomSetId");
|
||||
|
||||
b.ToTable("Machines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RomRepoMgr.Database.Models.RomSet", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Author")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Filename")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Homepage")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Sha384")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasMaxLength(96);
|
||||
|
||||
b.Property<DateTime>("UpdatedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Author");
|
||||
|
||||
b.HasIndex("Comment");
|
||||
|
||||
b.HasIndex("Date");
|
||||
|
||||
b.HasIndex("Description");
|
||||
|
||||
b.HasIndex("Filename");
|
||||
|
||||
b.HasIndex("Homepage");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("Sha384");
|
||||
|
||||
b.HasIndex("Version");
|
||||
|
||||
b.ToTable("RomSets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RomRepoMgr.Database.Models.FileByMachine", b =>
|
||||
{
|
||||
b.HasOne("RomRepoMgr.Database.Models.DbFile", "File")
|
||||
.WithMany("Machines")
|
||||
.HasForeignKey("FileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RomRepoMgr.Database.Models.Machine", b =>
|
||||
{
|
||||
b.HasOne("RomRepoMgr.Database.Models.RomSet", "RomSet")
|
||||
.WithMany("Machines")
|
||||
.HasForeignKey("RomSetId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RomRepoMgr.Database.Migrations
|
||||
{
|
||||
public partial class AddOriginalFilenameField : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AddColumn<string>("OriginalFileName", "Files", nullable: true);
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropColumn("OriginalFileName", "Files");
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ namespace RomRepoMgr.Database.Migrations
|
||||
|
||||
b.Property<string>("Md5").HasColumnType("TEXT").HasMaxLength(32);
|
||||
|
||||
b.Property<string>("OriginalFileName").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Sha1").HasColumnType("TEXT").HasMaxLength(40);
|
||||
|
||||
b.Property<string>("Sha256").HasColumnType("TEXT").HasMaxLength(64);
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace RomRepoMgr.Database.Models
|
||||
[StringLength(128, MinimumLength = 128)]
|
||||
public string Sha512 { get; set; }
|
||||
[DefaultValue(false)]
|
||||
public bool IsInRepo { get; set; }
|
||||
public virtual ICollection<FileByMachine> Machines { get; set; }
|
||||
public bool IsInRepo { get; set; }
|
||||
public string OriginalFileName { get; set; }
|
||||
public virtual ICollection<FileByMachine> Machines { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user