mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add media dump track images.
This commit is contained in:
5244
Marechai.Database/Migrations/20200611030041_AddMediaDumpTrackImages.Designer.cs
generated
Normal file
5244
Marechai.Database/Migrations/20200611030041_AddMediaDumpTrackImages.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,98 @@
|
||||
/******************************************************************************
|
||||
// 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 AddMediaDumpTrackImages : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<ulong>("TrackId", "MediaDumpSubchannelImages", nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable("MediaDumpTrackImages", 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), Format = table.Column<string>(nullable: true),
|
||||
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_MediaDumpTrackImages", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_MediaDumpTrackImages_MediaDumps_MediaDumpId", x => x.MediaDumpId, "MediaDumps",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpSubchannelImages_TrackId", "MediaDumpSubchannelImages", "TrackId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Format", "MediaDumpTrackImages", "Format");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Md5", "MediaDumpTrackImages", "Md5");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_MediaDumpId", "MediaDumpTrackImages", "MediaDumpId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Sha1", "MediaDumpTrackImages", "Sha1");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Sha256", "MediaDumpTrackImages", "Sha256");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Sha3", "MediaDumpTrackImages", "Sha3");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Size", "MediaDumpTrackImages", "Size");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MediaDumpTrackImages_Spamsum", "MediaDumpTrackImages", "Spamsum");
|
||||
|
||||
migrationBuilder.AddForeignKey("FK_MediaDumpSubchannelImages_MediaDumpTrackImages_TrackId",
|
||||
"MediaDumpSubchannelImages", "TrackId", "MediaDumpTrackImages",
|
||||
principalColumn: "Id", onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey("FK_MediaDumpSubchannelImages_MediaDumpTrackImages_TrackId",
|
||||
"MediaDumpSubchannelImages");
|
||||
|
||||
migrationBuilder.DropTable("MediaDumpTrackImages");
|
||||
|
||||
migrationBuilder.DropIndex("IX_MediaDumpSubchannelImages_TrackId", "MediaDumpSubchannelImages");
|
||||
|
||||
migrationBuilder.DropColumn("TrackId", "MediaDumpSubchannelImages");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1899,6 +1899,8 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
b.Property<byte>("Status").HasColumnType("tinyint unsigned");
|
||||
|
||||
b.Property<ulong?>("TrackId").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<short>("TrackSequence").HasColumnType("smallint");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
|
||||
@@ -1919,9 +1921,58 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
b.HasIndex("Spamsum");
|
||||
|
||||
b.HasIndex("TrackId").IsUnique();
|
||||
|
||||
b.ToTable("MediaDumpSubchannelImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.MediaDumpTrackImage", 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<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<short>("TrackSequence").HasColumnType("smallint");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Format");
|
||||
|
||||
b.HasIndex("Md5");
|
||||
|
||||
b.HasIndex("MediaDumpId");
|
||||
|
||||
b.HasIndex("Sha1");
|
||||
|
||||
b.HasIndex("Sha256");
|
||||
|
||||
b.HasIndex("Sha3");
|
||||
|
||||
b.HasIndex("Size");
|
||||
|
||||
b.HasIndex("Spamsum");
|
||||
|
||||
b.ToTable("MediaDumpTrackImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.MemoryByMachine", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("bigint(20)");
|
||||
@@ -3264,6 +3315,16 @@ namespace Marechai.Database.Migrations
|
||||
b.HasOne("Marechai.Database.Models.MediaDump", "MediaDump").WithOne("Subchannel").
|
||||
HasForeignKey("Marechai.Database.Models.MediaDumpSubchannelImage", "MediaDumpId").
|
||||
OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Marechai.Database.Models.MediaDumpTrackImage", "Track").WithOne("Subchannel").
|
||||
HasForeignKey("Marechai.Database.Models.MediaDumpSubchannelImage", "TrackId").
|
||||
OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.MediaDumpTrackImage", b =>
|
||||
{
|
||||
b.HasOne("Marechai.Database.Models.MediaDump", "MediaDump").WithMany("Tracks").
|
||||
HasForeignKey("MediaDumpId").OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.MemoryByMachine", b =>
|
||||
|
||||
@@ -116,6 +116,7 @@ namespace Marechai.Database.Models
|
||||
public virtual DbSet<MediaDumpFileImage> MediaDumpFileImages { get; set; }
|
||||
public virtual DbSet<MediaDumpImage> MediaDumpImages { get; set; }
|
||||
public virtual DbSet<MediaDumpSubchannelImage> MediaDumpSubchannelImages { get; set; }
|
||||
public virtual DbSet<MediaDumpTrackImage> MediaDumpTrackImages { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -1742,6 +1743,7 @@ namespace Marechai.Database.Models
|
||||
entity.Property(e => e.Sha3).HasConversion(hexToBytesConverter);
|
||||
|
||||
entity.HasOne(d => d.MediaDump).WithOne(p => p.Subchannel).OnDelete(DeleteBehavior.Cascade);
|
||||
entity.HasOne(d => d.Track).WithOne(p => p.Subchannel).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasIndex(e => e.Size);
|
||||
entity.HasIndex(e => e.Md5);
|
||||
@@ -1750,6 +1752,24 @@ namespace Marechai.Database.Models
|
||||
entity.HasIndex(e => e.Sha3);
|
||||
entity.HasIndex(e => e.Spamsum);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MediaDumpTrackImage>(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).WithMany(p => p.Tracks).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasIndex(e => e.Size);
|
||||
entity.HasIndex(e => e.Format);
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,9 @@ 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 MediaDumpSubchannelImage Subchannel { get; set; }
|
||||
public virtual ICollection<MediaDumpFileImage> Files { get; set; }
|
||||
public virtual MediaDumpImage Image { get; set; }
|
||||
public virtual MediaDumpSubchannelImage Subchannel { get; set; }
|
||||
public virtual ICollection<MediaDumpTrackImage> Tracks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,9 @@ namespace Marechai.Database.Models
|
||||
public string Sha3 { get; set; }
|
||||
public string Spamsum { get; set; }
|
||||
public ulong? MediaDumpId { get; set; }
|
||||
public ulong? TrackId { get; set; }
|
||||
|
||||
public virtual MediaDump MediaDump { get; set; }
|
||||
public virtual MediaDump MediaDump { get; set; }
|
||||
public virtual MediaDumpTrackImage Track { get; set; }
|
||||
}
|
||||
}
|
||||
48
Marechai.Database/Models/MediaDumpTrackImage.cs
Normal file
48
Marechai.Database/Models/MediaDumpTrackImage.cs
Normal 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 MediaDumpTrackImage : BaseModel<ulong>
|
||||
{
|
||||
public short TrackSequence { get; set; }
|
||||
public string Format { 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 virtual MediaDump MediaDump { get; set; }
|
||||
public virtual MediaDumpSubchannelImage Subchannel { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user