Add media dump subchannel images.

This commit is contained in:
2020-06-11 03:55:39 +01:00
parent dba2c9a258
commit 75d0bc4e9e
8 changed files with 5373 additions and 3 deletions

View File

@@ -512,4 +512,12 @@ namespace Marechai.Database
Verified = 1 << 11, MissingData = 1 << 12, MissingNonRequiredData = 1 << 13,
MissingEssentialData = 1 << 14, DamagedSubchannel = 1 << 15
}
[Flags]
public enum SubchannelStatus : byte
{
None = 0, P = 1 << 0, Q = 1 << 1,
R = 1 << 2, S = 1 << 3, T = 1 << 4,
U = 1 << 5, V = 1 << 6, W = 1 << 7
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Marechai.Database.Migrations
{
public partial class AddMediaDumpSubchannelImages : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("MediaDumpSubchannelImages", table => new
{
Id = table.Column<ulong>(nullable: false).
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
UpdatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
TrackSequence = table.Column<short>(nullable: false), Status = table.Column<byte>(nullable: false),
Size = table.Column<ulong>(nullable: false), Md5 = table.Column<byte[]>("binary(16)", nullable: true),
Sha1 = table.Column<byte[]>("binary(20)", nullable: true),
Sha256 = table.Column<byte[]>("binary(32)", nullable: true),
Sha3 = table.Column<byte[]>("binary(64)", nullable: true),
Spamsum = table.Column<string>(nullable: true), MediaDumpId = table.Column<ulong>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_MediaDumpSubchannelImages", x => x.Id);
table.ForeignKey("FK_MediaDumpSubchannelImages_MediaDumps_MediaDumpId", x => x.MediaDumpId,
"MediaDumps", "Id", onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_Md5", "MediaDumpSubchannelImages", "Md5");
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_MediaDumpId", "MediaDumpSubchannelImages",
"MediaDumpId", unique: true);
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_Sha1", "MediaDumpSubchannelImages", "Sha1");
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_Sha256", "MediaDumpSubchannelImages", "Sha256");
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_Sha3", "MediaDumpSubchannelImages", "Sha3");
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_Size", "MediaDumpSubchannelImages", "Size");
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_Spamsum", "MediaDumpSubchannelImages",
"Spamsum");
}
protected override void Down(MigrationBuilder migrationBuilder) =>
migrationBuilder.DropTable("MediaDumpSubchannelImages");
}
}

View File

@@ -1877,6 +1877,51 @@ namespace Marechai.Database.Migrations
b.ToTable("MediaDumpImages");
});
modelBuilder.Entity("Marechai.Database.Models.MediaDumpSubchannelImage", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<byte[]>("Md5").HasColumnType("binary(16)");
b.Property<ulong?>("MediaDumpId").HasColumnType("bigint unsigned");
b.Property<byte[]>("Sha1").HasColumnType("binary(20)");
b.Property<byte[]>("Sha256").HasColumnType("binary(32)");
b.Property<byte[]>("Sha3").HasColumnType("binary(64)");
b.Property<ulong>("Size").HasColumnType("bigint unsigned");
b.Property<string>("Spamsum").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<byte>("Status").HasColumnType("tinyint unsigned");
b.Property<short>("TrackSequence").HasColumnType("smallint");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("Md5");
b.HasIndex("MediaDumpId").IsUnique();
b.HasIndex("Sha1");
b.HasIndex("Sha256");
b.HasIndex("Sha3");
b.HasIndex("Size");
b.HasIndex("Spamsum");
b.ToTable("MediaDumpSubchannelImages");
});
modelBuilder.Entity("Marechai.Database.Models.MemoryByMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("bigint(20)");
@@ -3214,6 +3259,13 @@ namespace Marechai.Database.Migrations
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.MediaDumpSubchannelImage", b =>
{
b.HasOne("Marechai.Database.Models.MediaDump", "MediaDump").WithOne("Subchannel").
HasForeignKey("Marechai.Database.Models.MediaDumpSubchannelImage", "MediaDumpId").
OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Marechai.Database.Models.MemoryByMachine", b =>
{
b.HasOne("Marechai.Database.Models.Machine", "Machine").WithMany("Memory").HasForeignKey("MachineId").

View File

@@ -115,6 +115,7 @@ namespace Marechai.Database.Models
public virtual DbSet<MediaDump> MediaDumps { get; set; }
public virtual DbSet<MediaDumpFileImage> MediaDumpFileImages { get; set; }
public virtual DbSet<MediaDumpImage> MediaDumpImages { get; set; }
public virtual DbSet<MediaDumpSubchannelImage> MediaDumpSubchannelImages { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -1732,6 +1733,23 @@ namespace Marechai.Database.Models
entity.HasIndex(e => e.Spamsum);
entity.HasIndex(e => e.AccoustId);
});
modelBuilder.Entity<MediaDumpSubchannelImage>(entity =>
{
entity.Property(e => e.Md5).HasConversion(hexToBytesConverter);
entity.Property(e => e.Sha1).HasConversion(hexToBytesConverter);
entity.Property(e => e.Sha256).HasConversion(hexToBytesConverter);
entity.Property(e => e.Sha3).HasConversion(hexToBytesConverter);
entity.HasOne(d => d.MediaDump).WithOne(p => p.Subchannel).OnDelete(DeleteBehavior.Cascade);
entity.HasIndex(e => e.Size);
entity.HasIndex(e => e.Md5);
entity.HasIndex(e => e.Sha1);
entity.HasIndex(e => e.Sha256);
entity.HasIndex(e => e.Sha3);
entity.HasIndex(e => e.Spamsum);
});
}
}
}

View File

@@ -35,7 +35,8 @@ namespace Marechai.Database.Models
public string Format { get; set; }
public DumpStatus Status { get; set; }
public virtual ICollection<MediaDumpFileImage> Files { get; set; }
public virtual MediaDumpImage Image { get; set; }
public virtual ICollection<MediaDumpFileImage> Files { get; set; }
public virtual MediaDumpImage Image { get; set; }
public virtual MediaDumpSubchannelImage Subchannel { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System.ComponentModel.DataAnnotations.Schema;
namespace Marechai.Database.Models
{
public class MediaDumpSubchannelImage : BaseModel<ulong>
{
public short TrackSequence { get; set; }
public SubchannelStatus Status { get; set; }
public ulong Size { get; set; }
[Column(TypeName = "binary(16)")]
public string Md5 { get; set; }
[Column(TypeName = "binary(20)")]
public string Sha1 { get; set; }
[Column(TypeName = "binary(32)")]
public string Sha256 { get; set; }
[Column(TypeName = "binary(64)")]
public string Sha3 { get; set; }
public string Spamsum { get; set; }
public ulong? MediaDumpId { get; set; }
public virtual MediaDump MediaDump { get; set; }
}
}