Add software variant by compilation media.

This commit is contained in:
2020-06-12 00:12:30 +01:00
parent a00f01acd7
commit fd7a37d916
6 changed files with 6997 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,73 @@
/******************************************************************************
// 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 AddSoftwareByCompilationMedia : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("SoftwareVariantByCompilationMedia", 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),
Path = table.Column<string>(nullable: true), PathSeparator = table.Column<string>(nullable: false),
SoftwareVariantId = table.Column<ulong>(nullable: false), MediaId = table.Column<ulong>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_SoftwareVariantByCompilationMedia", x => x.Id);
table.ForeignKey("FK_SoftwareVariantByCompilationMedia_Media_MediaId", x => x.MediaId, "Media", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_SoftwareVariantByCompilationMedia_SoftwareVariants_SoftwareV~",
x => x.SoftwareVariantId, "SoftwareVariants", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_SoftwareVariantByCompilationMedia_MediaId",
"SoftwareVariantByCompilationMedia", "MediaId");
migrationBuilder.CreateIndex("IX_SoftwareVariantByCompilationMedia_Path",
"SoftwareVariantByCompilationMedia", "Path");
migrationBuilder.CreateIndex("IX_SoftwareVariantByCompilationMedia_SoftwareVariantId",
"SoftwareVariantByCompilationMedia", "SoftwareVariantId");
}
protected override void Down(MigrationBuilder migrationBuilder) =>
migrationBuilder.DropTable("SoftwareVariantByCompilationMedia");
}
}

View File

@@ -3466,6 +3466,33 @@ namespace Marechai.Database.Migrations
b.ToTable("SoftwareVariants");
});
modelBuilder.Entity("Marechai.Database.Models.SoftwareVariantByCompilationMedia", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<ulong>("MediaId").HasColumnType("bigint unsigned");
b.Property<string>("Path").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("PathSeparator").IsRequired().HasColumnType("varchar(1) CHARACTER SET utf8mb4");
b.Property<ulong>("SoftwareVariantId").HasColumnType("bigint unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("MediaId");
b.HasIndex("Path");
b.HasIndex("SoftwareVariantId");
b.ToTable("SoftwareVariantByCompilationMedia");
});
modelBuilder.Entity("Marechai.Database.Models.SoftwareVersion", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
@@ -4522,6 +4549,15 @@ namespace Marechai.Database.Migrations
HasForeignKey("SoftwareVersionId").OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.SoftwareVariantByCompilationMedia", b =>
{
b.HasOne("Marechai.Database.Models.Media", "Media").WithMany().HasForeignKey("MediaId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
b.HasOne("Marechai.Database.Models.SoftwareVariant", "SoftwareVariant").WithMany().
HasForeignKey("SoftwareVariantId").OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.SoftwareVersion", b =>
{
b.HasOne("Marechai.Database.Models.SoftwareFamily", "Family").WithMany("Versions").

View File

@@ -124,6 +124,7 @@ namespace Marechai.Database.Models
public virtual DbSet<StandaloneFile> StandaloneFiles { get; set; }
public virtual DbSet<MasteringText> MasteringTexts { get; set; }
public virtual DbSet<MediaTagDump> MediaTagDumps { get; set; }
public virtual DbSet<SoftwareVariantByCompilationMedia> SoftwareVariantByCompilationMedia { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -1991,6 +1992,11 @@ namespace Marechai.Database.Models
entity.HasOne(e => e.MediaDump).WithMany(e => e.Tags).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<SoftwareVariantByCompilationMedia>(entity =>
{
entity.HasIndex(e => e.Path);
});
}
}
}

View File

@@ -0,0 +1,41 @@
/******************************************************************************
// 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;
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public class SoftwareVariantByCompilationMedia : BaseModel<ulong>
{
public string Path { get; set; }
[DefaultValue('/')]
public char PathSeparator { get; set; }
[Required]
public virtual SoftwareVariant SoftwareVariant { get; set; }
[Required]
public virtual Media Media { get; set; }
}
}

View File

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