Add mastering texts.

This commit is contained in:
2020-06-11 23:33:19 +01:00
parent 0eda8e60f1
commit f066447c7a
8 changed files with 6858 additions and 1 deletions

View File

@@ -526,4 +526,11 @@ namespace Marechai.Database
Unknown = 0, Retail = 1, Bundle = 2,
Oem = 3
}
public enum MasteringTextType : byte
{
Unknown = 0, LotNumber = 1, MasteringSid = 2,
MouldSid = 3, MasteringCode = 4, Barcode = 5,
Toolstamp = 6
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
/******************************************************************************
// 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 AddMasteringTexts : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("MasteringTexts", 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),
Type = table.Column<byte>(nullable: false), Text = table.Column<string>(nullable: false),
Side = table.Column<short>(nullable: true), Layer = table.Column<short>(nullable: true),
MediaId = table.Column<ulong>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_MasteringTexts", x => x.Id);
table.ForeignKey("FK_MasteringTexts_Media_MediaId", x => x.MediaId, "Media", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_MasteringTexts_MediaId", "MasteringTexts", "MediaId");
migrationBuilder.CreateIndex("IX_MasteringTexts_Text", "MasteringTexts", "Text");
migrationBuilder.CreateIndex("IX_MasteringTexts_Type", "MasteringTexts", "Type");
}
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("MasteringTexts");
}
}

View File

@@ -1971,6 +1971,35 @@ namespace Marechai.Database.Migrations
b.ToTable("marechai_db");
});
modelBuilder.Entity("Marechai.Database.Models.MasteringText", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<short?>("Layer").HasColumnType("smallint");
b.Property<ulong>("MediaId").HasColumnType("bigint unsigned");
b.Property<short?>("Side").HasColumnType("smallint");
b.Property<string>("Text").IsRequired().HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<byte>("Type").HasColumnType("tinyint unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("MediaId");
b.HasIndex("Text");
b.HasIndex("Type");
b.ToTable("MasteringTexts");
});
modelBuilder.Entity("Marechai.Database.Models.Media", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
@@ -4172,6 +4201,12 @@ namespace Marechai.Database.Migrations
HasForeignKey("MagazineId").OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.MasteringText", b =>
{
b.HasOne("Marechai.Database.Models.Media", "Media").WithMany("MasteringTexts").HasForeignKey("MediaId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.MediaBySoftwareVariant", b =>
{
b.HasOne("Marechai.Database.Models.Media", "Media").WithMany("Software").HasForeignKey("MediaId").

View File

@@ -122,6 +122,7 @@ namespace Marechai.Database.Models
public virtual DbSet<SoftwareFamily> SoftwareFamilies { get; set; }
public virtual DbSet<SoftwareVariant> SoftwareVariants { get; set; }
public virtual DbSet<StandaloneFile> StandaloneFiles { get; set; }
public virtual DbSet<MasteringText> MasteringTexts { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -1973,6 +1974,13 @@ namespace Marechai.Database.Models
entity.HasOne(d => d.SoftwareVariant).WithMany(p => p.Files).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<MasteringText>(entity =>
{
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.Text);
entity.HasOne(d => d.Media).WithMany(p => p.MasteringTexts).OnDelete(DeleteBehavior.Cascade);
});
}
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public class MasteringText : BaseModel<ulong>
{
public MasteringTextType Type { get; set; }
[Required]
public string Text { get; set; }
public short? Side { get; set; }
public short? Layer { get; set; }
[Required]
public virtual Media Media { get; set; }
}
}

View File

@@ -61,5 +61,6 @@ namespace Marechai.Database.Models
public virtual ICollection<MediaDump> MediaDumps { get; set; }
public virtual ICollection<Dump> Dumps { get; set; }
public virtual ICollection<MediaBySoftwareVariant> Software { get; set; }
public virtual ICollection<MasteringText> MasteringTexts { get; set; }
}
}

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>4.0.0.1724</Version>
<Version>4.0.0.1726</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>