Add media dump.

This commit is contained in:
2020-06-11 03:10:01 +01:00
parent e31a8c4480
commit ccba6adf55
8 changed files with 5068 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System;
using System.ComponentModel.DataAnnotations;
// ReSharper disable UnusedMember.Global
@@ -500,4 +501,15 @@ namespace Marechai.Database
None = 0, Created = 1, Updated = 2,
Deleted = 3
}
[Flags]
public enum DumpStatus : ulong
{
Unknown = 0, Cracked = 1 << 0, Fixed = 1 << 1,
Hacked = 1 << 2, Modified = 1 << 3, Pirated = 1 << 4,
Trained = 1 << 5, Translated = 1 << 6, Overdumped = 1 << 7,
Underdumped = 1 << 8, Infected = 1 << 9, Damaged = 1 << 10,
Verified = 1 << 11, MissingData = 1 << 12, MissingNonRequiredData = 1 << 13,
MissingEssentialData = 1 << 14, DamagedSubchannel = 1 << 15
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
/******************************************************************************
// 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 AddMediaDump : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("MediaDumps", 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),
MediaId = table.Column<ulong>(nullable: false), Format = table.Column<string>(nullable: true),
Status = table.Column<ulong>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_MediaDumps", x => x.Id);
table.ForeignKey("FK_MediaDumps_Media_MediaId", x => x.MediaId, "Media", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_MediaDumps_Format", "MediaDumps", "Format");
migrationBuilder.CreateIndex("IX_MediaDumps_MediaId", "MediaDumps", "MediaId");
migrationBuilder.CreateIndex("IX_MediaDumps_Status", "MediaDumps", "Status");
}
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("MediaDumps");
}
}

View File

@@ -1741,6 +1741,31 @@ namespace Marechai.Database.Migrations
b.ToTable("Media");
});
modelBuilder.Entity("Marechai.Database.Models.MediaDump", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<string>("Format").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<ulong>("MediaId").HasColumnType("bigint unsigned");
b.Property<ulong>("Status").HasColumnType("bigint unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("Format");
b.HasIndex("MediaId");
b.HasIndex("Status");
b.ToTable("MediaDumps");
});
modelBuilder.Entity("Marechai.Database.Models.MemoryByMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("bigint(20)");
@@ -3050,6 +3075,12 @@ namespace Marechai.Database.Migrations
HasForeignKey("MagazineId").OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.MediaDump", b =>
{
b.HasOne("Marechai.Database.Models.Media", "Media").WithMany("Dumps").HasForeignKey("MediaId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.MemoryByMachine", b =>
{
b.HasOne("Marechai.Database.Models.Machine", "Machine").WithMany("Memory").HasForeignKey("MachineId").

View File

@@ -112,6 +112,7 @@ namespace Marechai.Database.Models
public virtual DbSet<LogicalPartition> LogicalPartitions { get; set; }
public virtual DbSet<FilesystemsByLogicalPartition> FilesystemsByLogicalPartition { get; set; }
public virtual DbSet<Media> Media { get; set; }
public virtual DbSet<MediaDump> MediaDumps { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -1679,6 +1680,14 @@ namespace Marechai.Database.Models
entity.HasOne(d => d.Media).WithMany(p => p.LogicalPartitions).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<MediaDump>(entity =>
{
entity.HasOne(d => d.Media).WithMany(p => p.Dumps).OnDelete(DeleteBehavior.Cascade);
entity.HasIndex(e => e.Status);
entity.HasIndex(e => e.Format);
});
}
}
}

View File

@@ -57,5 +57,6 @@ namespace Marechai.Database.Models
public StorageInterface? StorageInterface { get; set; }
public virtual ICollection<LogicalPartitionsByMedia> LogicalPartitions { get; set; }
public virtual ICollection<MediaDump> Dumps { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
/******************************************************************************
// 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;
namespace Marechai.Database.Models
{
public class MediaDump : BaseModel<ulong>
{
[Required]
public virtual Media Media { get; set; }
public string Format { get; set; }
public DumpStatus Status { get; set; }
}
}