Add software version.

This commit is contained in:
2020-06-11 19:10:13 +01:00
parent 41daba0aa5
commit dd4888d283
11 changed files with 8386 additions and 3921 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,159 @@
/******************************************************************************
// 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 AddSoftwareVersion : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("SoftwareVersion", 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),
FamilyId = table.Column<ulong>(nullable: false), Name = table.Column<string>(nullable: true),
Codename = table.Column<string>(nullable: true), Version = table.Column<string>(nullable: false),
Introduced = table.Column<DateTime>(nullable: true), LicenseId = table.Column<int>(nullable: true),
PreviousId = table.Column<ulong>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_SoftwareVersion", x => x.Id);
table.ForeignKey("FK_SoftwareVersion_SoftwareFamilies_FamilyId", x => x.FamilyId, "SoftwareFamilies",
"Id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_SoftwareVersion_Licenses_LicenseId", x => x.LicenseId, "Licenses", "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey("FK_SoftwareVersion_SoftwareVersion_PreviousId", x => x.PreviousId, "SoftwareVersion",
"Id", onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable("CompaniesBySoftwareVersion", 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),
CompanyId = table.Column<int>(nullable: false),
SoftwareVersionId = table.Column<ulong>(nullable: false), RoleId = table.Column<string>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_CompaniesBySoftwareVersion", x => x.Id);
table.ForeignKey("FK_CompaniesBySoftwareVersion_companies_CompanyId", x => x.CompanyId, "companies",
"id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_CompaniesBySoftwareVersion_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles",
"Id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_CompaniesBySoftwareVersion_SoftwareVersion_SoftwareVersionId",
x => x.SoftwareVersionId, "SoftwareVersion", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("PeopleBySoftwareVersion", 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),
SoftwareVersionId = table.Column<ulong>(nullable: false), PersonId = table.Column<int>(nullable: false),
RoleId = table.Column<string>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_PeopleBySoftwareVersion", x => x.Id);
table.ForeignKey("FK_PeopleBySoftwareVersion_People_PersonId", x => x.PersonId, "People", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_PeopleBySoftwareVersion_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles",
"Id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_PeopleBySoftwareVersion_SoftwareVersion_SoftwareVersionId",
x => x.SoftwareVersionId, "SoftwareVersion", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_CompaniesBySoftwareVersion_CompanyId", "CompaniesBySoftwareVersion",
"CompanyId");
migrationBuilder.CreateIndex("IX_CompaniesBySoftwareVersion_RoleId", "CompaniesBySoftwareVersion",
"RoleId");
migrationBuilder.CreateIndex("IX_CompaniesBySoftwareVersion_SoftwareVersionId",
"CompaniesBySoftwareVersion", "SoftwareVersionId");
migrationBuilder.CreateIndex("IX_PeopleBySoftwareVersion_PersonId", "PeopleBySoftwareVersion", "PersonId");
migrationBuilder.CreateIndex("IX_PeopleBySoftwareVersion_RoleId", "PeopleBySoftwareVersion", "RoleId");
migrationBuilder.CreateIndex("IX_PeopleBySoftwareVersion_SoftwareVersionId", "PeopleBySoftwareVersion",
"SoftwareVersionId");
migrationBuilder.CreateIndex("IX_SoftwareVersion_Codename", "SoftwareVersion", "Codename");
migrationBuilder.CreateIndex("IX_SoftwareVersion_FamilyId", "SoftwareVersion", "FamilyId");
migrationBuilder.CreateIndex("IX_SoftwareVersion_Introduced", "SoftwareVersion", "Introduced");
migrationBuilder.CreateIndex("IX_SoftwareVersion_LicenseId", "SoftwareVersion", "LicenseId");
migrationBuilder.CreateIndex("IX_SoftwareVersion_Name", "SoftwareVersion", "Name");
migrationBuilder.CreateIndex("IX_SoftwareVersion_PreviousId", "SoftwareVersion", "PreviousId",
unique: true);
migrationBuilder.CreateIndex("IX_SoftwareVersion_Version", "SoftwareVersion", "Version");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("CompaniesBySoftwareVersion");
migrationBuilder.DropTable("PeopleBySoftwareVersion");
migrationBuilder.DropTable("SoftwareVersion");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
/******************************************************************************
// 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 CompaniesBySoftwareVersion : BaseModel<ulong>
{
[Required]
public virtual Company Company { get; set; }
[Required]
public virtual SoftwareVersion SoftwareVersion { get; set; }
[Required]
public virtual DocumentRole Role { get; set; }
}
}

View File

@@ -85,5 +85,6 @@ namespace Marechai.Database.Models
public virtual CompanyLogo LastLogo => Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
public virtual DocumentCompany DocumentCompany { get; set; }
public virtual ICollection<CompaniesBySoftwareFamily> SoftwareFamilies { get; set; }
public virtual ICollection<CompaniesBySoftwareVersion> SoftwareVersions { get; set; }
}
}

View File

@@ -1830,6 +1830,29 @@ namespace Marechai.Database.Models
entity.HasOne(d => d.Person).WithMany(p => p.SoftwareFamilies).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.SoftwareFamily).WithMany(p => p.People).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<SoftwareVersion>(entity =>
{
entity.HasIndex(e => e.Name);
entity.HasIndex(e => e.Introduced);
entity.HasIndex(e => e.Codename);
entity.HasIndex(e => e.Version);
entity.HasOne(e => e.Family).WithMany(e => e.Versions).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(e => e.Previous).WithOne(e => e.Next).OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<CompaniesBySoftwareVersion>(entity =>
{
entity.HasOne(d => d.Company).WithMany(p => p.SoftwareVersions).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.SoftwareVersion).WithMany(p => p.Companies).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<PeopleBySoftwareVersion>(entity =>
{
entity.HasOne(d => d.Person).WithMany(p => p.SoftwareVersions).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.SoftwareVersion).WithMany(p => p.People).OnDelete(DeleteBehavior.Cascade);
});
}
}
}

View File

@@ -0,0 +1,39 @@
/******************************************************************************
// 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 PeopleBySoftwareVersion : BaseModel<ulong>
{
[Required]
public virtual SoftwareVersion SoftwareVersion { get; set; }
[Required]
public virtual Person Person { get; set; }
[Required]
public virtual DocumentRole Role { get; set; }
}
}

View File

@@ -61,5 +61,6 @@ namespace Marechai.Database.Models
public virtual ICollection<PeopleByCompany> Companies { get; set; }
public virtual DocumentPerson DocumentPerson { get; set; }
public virtual ICollection<PeopleBySoftwareFamily> SoftwareFamilies { get; set; }
public virtual ICollection<PeopleBySoftwareVersion> SoftwareVersions { get; set; }
}
}

View File

@@ -39,5 +39,6 @@ namespace Marechai.Database.Models
public virtual ICollection<SoftwareFamily> Children { get; set; }
public virtual ICollection<CompaniesBySoftwareFamily> Companies { get; set; }
public virtual ICollection<PeopleBySoftwareFamily> People { get; set; }
public virtual ICollection<SoftwareVersion> Versions { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
/******************************************************************************
// 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 System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public class SoftwareVersion : BaseModel<ulong>
{
[Required]
public virtual SoftwareFamily Family { get; set; }
public string Name { get; set; }
public string Codename { get; set; }
[Required]
public string Version { get; set; }
public DateTime? Introduced { get; set; }
public virtual License License { get; set; }
public virtual SoftwareVersion Previous { get; set; }
public virtual SoftwareVersion Next { get; set; }
public virtual ICollection<CompaniesBySoftwareVersion> Companies { get; set; }
public virtual ICollection<PeopleBySoftwareVersion> People { get; set; }
}
}

View File

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