mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add logical partitions by media.
This commit is contained in:
4869
Marechai.Database/Migrations/20200611004927_AddLogicalPartitionsByMedia.Designer.cs
generated
Normal file
4869
Marechai.Database/Migrations/20200611004927_AddLogicalPartitionsByMedia.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
/******************************************************************************
|
||||
// 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 AddLogicalPartitionsByMedia : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("LogicalPartitionsByMedia", 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),
|
||||
MediaId = table.Column<ulong>(nullable: false), PartitionId = table.Column<ulong>(nullable: false)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LogicalPartitionsByMedia", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_LogicalPartitionsByMedia_Media_MediaId", x => x.MediaId, "Media", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_LogicalPartitionsByMedia_LogicalPartitions_PartitionId", x => x.PartitionId,
|
||||
"LogicalPartitions", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitionsByMedia_MediaId", "LogicalPartitionsByMedia", "MediaId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitionsByMedia_PartitionId", "LogicalPartitionsByMedia",
|
||||
"PartitionId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("LogicalPartitionsByMedia");
|
||||
}
|
||||
}
|
||||
@@ -1279,6 +1279,27 @@ namespace Marechai.Database.Migrations
|
||||
b.ToTable("LogicalPartitions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.LogicalPartitionsByMedia", 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<ulong>("PartitionId").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.HasIndex("PartitionId");
|
||||
|
||||
b.ToTable("LogicalPartitionsByMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.Machine", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -2962,6 +2983,15 @@ namespace Marechai.Database.Migrations
|
||||
HasForeignKey("ProcessorId").HasConstraintName("fk_extension_processor_id").IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.LogicalPartitionsByMedia", b =>
|
||||
{
|
||||
b.HasOne("Marechai.Database.Models.Media", "Media").WithMany("LogicalPartitions").
|
||||
HasForeignKey("MediaId").OnDelete(DeleteBehavior.Cascade).IsRequired();
|
||||
|
||||
b.HasOne("Marechai.Database.Models.LogicalPartition", "Partition").WithMany("Media").
|
||||
HasForeignKey("PartitionId").OnDelete(DeleteBehavior.Cascade).IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.Machine", b =>
|
||||
{
|
||||
b.HasOne("Marechai.Database.Models.Company", "Company").WithMany("Machines").HasForeignKey("CompanyId").
|
||||
|
||||
@@ -41,5 +41,6 @@ namespace Marechai.Database.Models
|
||||
public string Scheme { get; set; }
|
||||
|
||||
public virtual ICollection<FilesystemsByLogicalPartition> Filesystems { get; set; }
|
||||
public virtual ICollection<LogicalPartitionsByMedia> Media { get; set; }
|
||||
}
|
||||
}
|
||||
37
Marechai.Database/Models/LogicalPartitionsByMedia.cs
Normal file
37
Marechai.Database/Models/LogicalPartitionsByMedia.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
/******************************************************************************
|
||||
// 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 LogicalPartitionsByMedia : BaseModel<ulong>
|
||||
{
|
||||
[Required]
|
||||
public virtual Media Media { get; set; }
|
||||
[Required]
|
||||
public virtual LogicalPartition Partition { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1672,6 +1672,13 @@ namespace Marechai.Database.Models
|
||||
entity.HasIndex(e => e.Revision);
|
||||
entity.HasIndex(e => e.Firmware);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<LogicalPartitionsByMedia>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Partition).WithMany(p => p.Media).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(d => d.Media).WithMany(p => p.LogicalPartitions).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.CommonTypes;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
@@ -54,5 +55,7 @@ namespace Marechai.Database.Models
|
||||
public int? LogicalBlockSize { get; set; }
|
||||
public JsonObject<VariableBlockSize[]> BlockSizes { get; set; }
|
||||
public StorageInterface? StorageInterface { get; set; }
|
||||
|
||||
public virtual ICollection<LogicalPartitionsByMedia> LogicalPartitions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>4.0.0.1681</Version>
|
||||
<Version>4.0.0.1684</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user