mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add software version.
This commit is contained in:
5846
Marechai.Database/Migrations/20200611180218_AddSoftwareVersion.Designer.cs
generated
Normal file
5846
Marechai.Database/Migrations/20200611180218_AddSoftwareVersion.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
39
Marechai.Database/Models/CompaniesBySoftwareVersion.cs
Normal file
39
Marechai.Database/Models/CompaniesBySoftwareVersion.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Marechai.Database/Models/PeopleBySoftwareVersion.cs
Normal file
39
Marechai.Database/Models/PeopleBySoftwareVersion.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -57,9 +57,10 @@ namespace Marechai.Database.Models
|
||||
[NotMapped, DisplayName("Name")]
|
||||
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
|
||||
|
||||
public short? CountryOfBirthId { get; set; }
|
||||
public virtual ICollection<PeopleByCompany> Companies { get; set; }
|
||||
public virtual DocumentPerson DocumentPerson { get; set; }
|
||||
public virtual ICollection<PeopleBySoftwareFamily> SoftwareFamilies { get; set; }
|
||||
public short? CountryOfBirthId { get; set; }
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -32,12 +32,13 @@ namespace Marechai.Database.Models
|
||||
public class SoftwareFamily : BaseModel<ulong>
|
||||
{
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTime? Introduced { get; set; }
|
||||
public virtual SoftwareFamily Parent { get; set; }
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
47
Marechai.Database/Models/SoftwareVersion.cs
Normal file
47
Marechai.Database/Models/SoftwareVersion.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user