Add DOSCenter's modification date.

This commit is contained in:
2020-09-06 19:09:35 +01:00
parent 7f24956ddd
commit 9ee547e83e
8 changed files with 745 additions and 180 deletions

View File

@@ -151,7 +151,7 @@ namespace RomRepoMgr.Core.Filesystem
st_mode = FilePermissions.S_IFREG | NativeConvert.FromOctalPermissionString("0444"),
st_nlink = 1,
st_ctime = NativeConvert.ToTimeT(file.CreatedOn.ToUniversalTime()),
st_mtime = NativeConvert.ToTimeT(file.UpdatedOn.ToUniversalTime()),
st_mtime = NativeConvert.ToTimeT(file.FileLastModification?.ToUniversalTime() ?? file.UpdatedOn.ToUniversalTime()),
st_blksize = 512,
st_blocks = (long)(file.Size / 512),
st_ino = file.Id,
@@ -289,7 +289,7 @@ namespace RomRepoMgr.Core.Filesystem
st_mode = FilePermissions.S_IFREG | NativeConvert.FromOctalPermissionString("0444"),
st_nlink = 1,
st_ctime = NativeConvert.ToTimeT(file.CreatedOn.ToUniversalTime()),
st_mtime = NativeConvert.ToTimeT(file.UpdatedOn.ToUniversalTime()),
st_mtime = NativeConvert.ToTimeT(file.FileLastModification?.ToUniversalTime() ?? file.UpdatedOn.ToUniversalTime()),
st_blksize = 512,
st_blocks = (long)(file.Size / 512),
st_ino = file.Id,

View File

@@ -248,7 +248,8 @@ namespace RomRepoMgr.Core.Filesystem
Sha512 = machineFile.File.Sha512,
Size = machineFile.File.Size,
CreatedOn = machineFile.File.CreatedOn,
UpdatedOn = machineFile.File.UpdatedOn
UpdatedOn = machineFile.File.UpdatedOn,
FileLastModification = machineFile.FileLastModification
};
cachedMachineFiles[machineFile.Name] = cachedFile;
@@ -682,16 +683,17 @@ namespace RomRepoMgr.Core.Filesystem
internal sealed class CachedFile
{
public ulong Id { get; set; }
public ulong Size { get; set; }
public string Crc32 { get; set; }
public string Md5 { get; set; }
public string Sha1 { get; set; }
public string Sha256 { get; set; }
public string Sha384 { get; set; }
public string Sha512 { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime UpdatedOn { get; set; }
public ulong Id { get; set; }
public ulong Size { get; set; }
public string Crc32 { get; set; }
public string Md5 { get; set; }
public string Sha1 { get; set; }
public string Sha256 { get; set; }
public string Sha384 { get; set; }
public string Sha512 { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime UpdatedOn { get; set; }
public DateTime? FileLastModification { get; set; }
}
internal sealed class CachedDisk

View File

@@ -276,7 +276,7 @@ namespace RomRepoMgr.Core.Filesystem
(uint)(FileAttributes.Normal | FileAttributes.Compressed | FileAttributes.ReadOnly),
IndexNumber = file.Id,
LastAccessTime = (ulong)DateTime.UtcNow.ToFileTimeUtc(),
LastWriteTime = (ulong)file.UpdatedOn.ToFileTimeUtc()
LastWriteTime = (ulong)(file.FileLastModification?.ToFileTimeUtc() ?? file.UpdatedOn.ToFileTimeUtc())
};
fileNode = new FileNode
@@ -473,7 +473,7 @@ namespace RomRepoMgr.Core.Filesystem
(uint)(FileAttributes.Normal | FileAttributes.Compressed | FileAttributes.ReadOnly),
IndexNumber = file.Value.Id,
LastAccessTime = (ulong)DateTime.UtcNow.ToFileTimeUtc(),
LastWriteTime = (ulong)file.Value.UpdatedOn.ToFileTimeUtc()
LastWriteTime = (ulong)(file.Value.FileLastModification?.ToFileTimeUtc() ?? file.Value.UpdatedOn.ToFileTimeUtc())
}
}));

View File

@@ -26,6 +26,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using Aaru.Checksums;
@@ -212,6 +213,10 @@ namespace RomRepoMgr.Core.Workers
case Media media:
medias.Add(media);
continue;
default:
Console.WriteLine(item);
continue;
}
}
@@ -410,11 +415,21 @@ namespace RomRepoMgr.Core.Workers
file.UpdatedOn = DateTime.UtcNow;
}
DateTime? fileModificationDate = null;
if(!string.IsNullOrEmpty(rom.Date))
{
if(DateTime.TryParseExact(rom.Date, @"yyyy\\M\\d H:mm", CultureInfo.InvariantCulture,
DateTimeStyles.AssumeUniversal, out DateTime date))
fileModificationDate = date;
}
newFilesByMachine.Add(new FileByMachine
{
File = file,
Machine = machine,
Name = rom.Name
File = file,
Machine = machine,
Name = rom.Name,
FileLastModification = fileModificationDate
});
if(hashCollision)

View File

@@ -0,0 +1,420 @@
// <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("20200906173342_AddFileModification")]
partial class AddFileModification
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.7");
modelBuilder.Entity("RomRepoMgr.Database.Models.DbDisk", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
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<ulong?>("Size")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("IsInRepo");
b.HasIndex("Md5");
b.HasIndex("Sha1");
b.HasIndex("Size");
b.ToTable("Disks");
});
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("IsInRepo");
b.HasIndex("Md5");
b.HasIndex("Sha1");
b.HasIndex("Sha256");
b.HasIndex("Sha384");
b.HasIndex("Sha512");
b.HasIndex("Size");
b.ToTable("Files");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.DbMedia", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
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<ulong?>("Size")
.HasColumnType("INTEGER");
b.Property<string>("SpamSum")
.HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("IsInRepo");
b.HasIndex("Md5");
b.HasIndex("Sha1");
b.HasIndex("Sha256");
b.HasIndex("Size");
b.HasIndex("SpamSum");
b.ToTable("Medias");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.DiskByMachine", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("DiskId")
.HasColumnType("INTEGER");
b.Property<ulong>("MachineId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("DiskId");
b.HasIndex("MachineId");
b.HasIndex("Name");
b.ToTable("DisksByMachines");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.FileByMachine", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("FileId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("FileLastModification")
.HasColumnType("TEXT");
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.MediaByMachine", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("MachineId")
.HasColumnType("INTEGER");
b.Property<ulong>("MediaId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MachineId");
b.HasIndex("MediaId");
b.HasIndex("Name");
b.ToTable("MediasByMachines");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.RomSet", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Author")
.HasColumnType("TEXT");
b.Property<string>("Category")
.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("Category");
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.DiskByMachine", b =>
{
b.HasOne("RomRepoMgr.Database.Models.DbDisk", "Disk")
.WithMany("Machines")
.HasForeignKey("DiskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine")
.WithMany("Disks")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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();
});
modelBuilder.Entity("RomRepoMgr.Database.Models.MediaByMachine", b =>
{
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine")
.WithMany("Medias")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RomRepoMgr.Database.Models.DbMedia", "Media")
.WithMany("Machines")
.HasForeignKey("MediaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace RomRepoMgr.Database.Migrations
{
public partial class AddFileModification : Migration
{
protected override void Up(MigrationBuilder migrationBuilder) =>
migrationBuilder.AddColumn<DateTime>("FileLastModification", "FilesByMachines", nullable: true);
protected override void Down(MigrationBuilder migrationBuilder) =>
migrationBuilder.DropColumn("FileLastModification", "FilesByMachines");
}
}

View File

@@ -1,306 +1,418 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RomRepoMgr.Database;
namespace RomRepoMgr.Database.Migrations
{
[DbContext(typeof(Context))]
internal class ContextModelSnapshot : ModelSnapshot
partial class ContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "3.1.7");
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.7");
modelBuilder.Entity("RomRepoMgr.Database.Models.DbDisk", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedOn").HasColumnType("TEXT");
b.Property<DateTime>("CreatedOn")
.HasColumnType("TEXT");
b.Property<bool>("IsInRepo").HasColumnType("INTEGER");
b.Property<bool>("IsInRepo")
.HasColumnType("INTEGER");
b.Property<string>("Md5").HasColumnType("TEXT").HasMaxLength(32);
b.Property<string>("Md5")
.HasColumnType("TEXT")
.HasMaxLength(32);
b.Property<string>("OriginalFileName").HasColumnType("TEXT");
b.Property<string>("OriginalFileName")
.HasColumnType("TEXT");
b.Property<string>("Sha1").HasColumnType("TEXT").HasMaxLength(40);
b.Property<string>("Sha1")
.HasColumnType("TEXT")
.HasMaxLength(40);
b.Property<ulong?>("Size").HasColumnType("INTEGER");
b.Property<ulong?>("Size")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpdatedOn").HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("IsInRepo");
b.HasIndex("IsInRepo");
b.HasIndex("Md5");
b.HasIndex("Md5");
b.HasIndex("Sha1");
b.HasIndex("Sha1");
b.HasIndex("Size");
b.HasIndex("Size");
b.ToTable("Disks");
});
b.ToTable("Disks");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.DbFile", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Crc32").HasColumnType("TEXT").HasMaxLength(8);
b.Property<string>("Crc32")
.HasColumnType("TEXT")
.HasMaxLength(8);
b.Property<DateTime>("CreatedOn").HasColumnType("TEXT");
b.Property<DateTime>("CreatedOn")
.HasColumnType("TEXT");
b.Property<bool>("IsInRepo").HasColumnType("INTEGER");
b.Property<bool>("IsInRepo")
.HasColumnType("INTEGER");
b.Property<string>("Md5").HasColumnType("TEXT").HasMaxLength(32);
b.Property<string>("Md5")
.HasColumnType("TEXT")
.HasMaxLength(32);
b.Property<string>("OriginalFileName").HasColumnType("TEXT");
b.Property<string>("OriginalFileName")
.HasColumnType("TEXT");
b.Property<string>("Sha1").HasColumnType("TEXT").HasMaxLength(40);
b.Property<string>("Sha1")
.HasColumnType("TEXT")
.HasMaxLength(40);
b.Property<string>("Sha256").HasColumnType("TEXT").HasMaxLength(64);
b.Property<string>("Sha256")
.HasColumnType("TEXT")
.HasMaxLength(64);
b.Property<string>("Sha384").HasColumnType("TEXT").HasMaxLength(96);
b.Property<string>("Sha384")
.HasColumnType("TEXT")
.HasMaxLength(96);
b.Property<string>("Sha512").HasColumnType("TEXT").HasMaxLength(128);
b.Property<string>("Sha512")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<ulong>("Size").HasColumnType("INTEGER");
b.Property<ulong>("Size")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpdatedOn").HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("Crc32");
b.HasIndex("Crc32");
b.HasIndex("IsInRepo");
b.HasIndex("IsInRepo");
b.HasIndex("Md5");
b.HasIndex("Md5");
b.HasIndex("Sha1");
b.HasIndex("Sha1");
b.HasIndex("Sha256");
b.HasIndex("Sha256");
b.HasIndex("Sha384");
b.HasIndex("Sha384");
b.HasIndex("Sha512");
b.HasIndex("Sha512");
b.HasIndex("Size");
b.HasIndex("Size");
b.ToTable("Files");
});
b.ToTable("Files");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.DbMedia", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedOn").HasColumnType("TEXT");
b.Property<DateTime>("CreatedOn")
.HasColumnType("TEXT");
b.Property<bool>("IsInRepo").HasColumnType("INTEGER");
b.Property<bool>("IsInRepo")
.HasColumnType("INTEGER");
b.Property<string>("Md5").HasColumnType("TEXT").HasMaxLength(32);
b.Property<string>("Md5")
.HasColumnType("TEXT")
.HasMaxLength(32);
b.Property<string>("OriginalFileName").HasColumnType("TEXT");
b.Property<string>("OriginalFileName")
.HasColumnType("TEXT");
b.Property<string>("Sha1").HasColumnType("TEXT").HasMaxLength(40);
b.Property<string>("Sha1")
.HasColumnType("TEXT")
.HasMaxLength(40);
b.Property<string>("Sha256").HasColumnType("TEXT").HasMaxLength(64);
b.Property<string>("Sha256")
.HasColumnType("TEXT")
.HasMaxLength(64);
b.Property<ulong?>("Size").HasColumnType("INTEGER");
b.Property<ulong?>("Size")
.HasColumnType("INTEGER");
b.Property<string>("SpamSum").HasColumnType("TEXT");
b.Property<string>("SpamSum")
.HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn").HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("IsInRepo");
b.HasIndex("IsInRepo");
b.HasIndex("Md5");
b.HasIndex("Md5");
b.HasIndex("Sha1");
b.HasIndex("Sha1");
b.HasIndex("Sha256");
b.HasIndex("Sha256");
b.HasIndex("Size");
b.HasIndex("Size");
b.HasIndex("SpamSum");
b.HasIndex("SpamSum");
b.ToTable("Medias");
});
b.ToTable("Medias");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.DiskByMachine", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("DiskId").HasColumnType("INTEGER");
b.Property<ulong>("DiskId")
.HasColumnType("INTEGER");
b.Property<ulong>("MachineId").HasColumnType("INTEGER");
b.Property<ulong>("MachineId")
.HasColumnType("INTEGER");
b.Property<string>("Name").IsRequired().HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("DiskId");
b.HasIndex("DiskId");
b.HasIndex("MachineId");
b.HasIndex("MachineId");
b.HasIndex("Name");
b.HasIndex("Name");
b.ToTable("DisksByMachines");
});
b.ToTable("DisksByMachines");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.FileByMachine", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("FileId").HasColumnType("INTEGER");
b.Property<ulong>("FileId")
.HasColumnType("INTEGER");
b.Property<ulong>("MachineId").HasColumnType("INTEGER");
b.Property<DateTime?>("FileLastModification")
.HasColumnType("TEXT");
b.Property<string>("Name").IsRequired().HasColumnType("TEXT");
b.Property<ulong>("MachineId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasIndex("FileId");
b.HasKey("Id");
b.HasIndex("MachineId");
b.HasIndex("FileId");
b.HasIndex("Name");
b.HasIndex("MachineId");
b.ToTable("FilesByMachines");
});
b.HasIndex("Name");
b.ToTable("FilesByMachines");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.Machine", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedOn").HasColumnType("TEXT");
b.Property<DateTime>("CreatedOn")
.HasColumnType("TEXT");
b.Property<string>("Name").IsRequired().HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("RomSetId").HasColumnType("INTEGER");
b.Property<long>("RomSetId")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpdatedOn").HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("Name");
b.HasIndex("Name");
b.HasIndex("RomSetId");
b.HasIndex("RomSetId");
b.ToTable("Machines");
});
b.ToTable("Machines");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.MediaByMachine", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("MachineId").HasColumnType("INTEGER");
b.Property<ulong>("MachineId")
.HasColumnType("INTEGER");
b.Property<ulong>("MediaId").HasColumnType("INTEGER");
b.Property<ulong>("MediaId")
.HasColumnType("INTEGER");
b.Property<string>("Name").IsRequired().HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("MachineId");
b.HasIndex("MachineId");
b.HasIndex("MediaId");
b.HasIndex("MediaId");
b.HasIndex("Name");
b.HasIndex("Name");
b.ToTable("MediasByMachines");
});
b.ToTable("MediasByMachines");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.RomSet", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Author").HasColumnType("TEXT");
b.Property<string>("Author")
.HasColumnType("TEXT");
b.Property<string>("Category").HasColumnType("TEXT");
b.Property<string>("Category")
.HasColumnType("TEXT");
b.Property<string>("Comment").HasColumnType("TEXT");
b.Property<string>("Comment")
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedOn").HasColumnType("TEXT");
b.Property<DateTime>("CreatedOn")
.HasColumnType("TEXT");
b.Property<string>("Date").HasColumnType("TEXT");
b.Property<string>("Date")
.HasColumnType("TEXT");
b.Property<string>("Description").HasColumnType("TEXT");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("Filename").IsRequired().HasColumnType("TEXT");
b.Property<string>("Filename")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Homepage").HasColumnType("TEXT");
b.Property<string>("Homepage")
.HasColumnType("TEXT");
b.Property<string>("Name").HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Sha384").IsRequired().HasColumnType("TEXT").HasMaxLength(96);
b.Property<string>("Sha384")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(96);
b.Property<DateTime>("UpdatedOn").HasColumnType("TEXT");
b.Property<DateTime>("UpdatedOn")
.HasColumnType("TEXT");
b.Property<string>("Version").HasColumnType("TEXT");
b.Property<string>("Version")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasKey("Id");
b.HasIndex("Author");
b.HasIndex("Author");
b.HasIndex("Category");
b.HasIndex("Category");
b.HasIndex("Comment");
b.HasIndex("Comment");
b.HasIndex("Date");
b.HasIndex("Date");
b.HasIndex("Description");
b.HasIndex("Description");
b.HasIndex("Filename");
b.HasIndex("Filename");
b.HasIndex("Homepage");
b.HasIndex("Homepage");
b.HasIndex("Name");
b.HasIndex("Name");
b.HasIndex("Sha384");
b.HasIndex("Sha384");
b.HasIndex("Version");
b.HasIndex("Version");
b.ToTable("RomSets");
});
b.ToTable("RomSets");
});
modelBuilder.Entity("RomRepoMgr.Database.Models.DiskByMachine", b =>
{
b.HasOne("RomRepoMgr.Database.Models.DbDisk", "Disk").WithMany("Machines").HasForeignKey("DiskId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
{
b.HasOne("RomRepoMgr.Database.Models.DbDisk", "Disk")
.WithMany("Machines")
.HasForeignKey("DiskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine").WithMany("Disks").HasForeignKey("MachineId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine")
.WithMany("Disks")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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.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();
});
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();
});
{
b.HasOne("RomRepoMgr.Database.Models.RomSet", "RomSet")
.WithMany("Machines")
.HasForeignKey("RomSetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RomRepoMgr.Database.Models.MediaByMachine", b =>
{
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine").WithMany("Medias").HasForeignKey("MachineId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
{
b.HasOne("RomRepoMgr.Database.Models.Machine", "Machine")
.WithMany("Medias")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RomRepoMgr.Database.Models.DbMedia", "Media").WithMany("Machines").HasForeignKey("MediaId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
#pragma warning restore 612, 618
b.HasOne("RomRepoMgr.Database.Models.DbMedia", "Media")
.WithMany("Machines")
.HasForeignKey("MediaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
}

View File

@@ -23,6 +23,7 @@
// Copyright © 2020 Natalia Portillo
*******************************************************************************/
using System;
using System.ComponentModel.DataAnnotations;
namespace RomRepoMgr.Database.Models
@@ -36,8 +37,9 @@ namespace RomRepoMgr.Database.Models
[Required]
public virtual Machine Machine { get; set; }
[Required]
public string Name { get; set; }
public ulong FileId { get; set; }
public ulong MachineId { get; set; }
public string Name { get; set; }
public ulong FileId { get; set; }
public ulong MachineId { get; set; }
public DateTime? FileLastModification { get; set; }
}
}