mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 11:04:25 +00:00
Add logical partitions.
This commit is contained in:
4712
Marechai.Database/Migrations/20200610233739_AddLogicalPartitions.Designer.cs
generated
Normal file
4712
Marechai.Database/Migrations/20200610233739_AddLogicalPartitions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
/******************************************************************************
|
||||
// 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 AddLogicalPartitions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("LogicalPartitions", 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),
|
||||
Sequence = table.Column<uint>(nullable: false), Name = table.Column<string>(nullable: true),
|
||||
Type = table.Column<string>(nullable: false), FirstSector = table.Column<ulong>(nullable: false),
|
||||
LastSector = table.Column<ulong>(nullable: false), Size = table.Column<ulong>(nullable: false),
|
||||
Description = table.Column<string>(nullable: true), Scheme = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LogicalPartitions", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("FilesystemsByLogicalPartition", 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),
|
||||
FilesystemId = table.Column<ulong>(nullable: false), PartitionId = table.Column<ulong>(nullable: false)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FilesystemsByLogicalPartition", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_FilesystemsByLogicalPartition_Filesystems_FilesystemId", x => x.FilesystemId,
|
||||
"Filesystems", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_FilesystemsByLogicalPartition_LogicalPartitions_PartitionId", x => x.PartitionId,
|
||||
"LogicalPartitions", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_FilesystemsByLogicalPartition_FilesystemId",
|
||||
"FilesystemsByLogicalPartition", "FilesystemId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_FilesystemsByLogicalPartition_PartitionId",
|
||||
"FilesystemsByLogicalPartition", "PartitionId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitions_Description", "LogicalPartitions", "Description");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitions_FirstSector", "LogicalPartitions", "FirstSector");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitions_LastSector", "LogicalPartitions", "LastSector");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitions_Name", "LogicalPartitions", "Name");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitions_Scheme", "LogicalPartitions", "Scheme");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_LogicalPartitions_Type", "LogicalPartitions", "Type");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("FilesystemsByLogicalPartition");
|
||||
|
||||
migrationBuilder.DropTable("LogicalPartitions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -886,6 +886,27 @@ namespace Marechai.Database.Migrations
|
||||
b.ToTable("Filesystems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.FilesystemsByLogicalPartition", b =>
|
||||
{
|
||||
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<ulong>("FilesystemId").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("PartitionId").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FilesystemId");
|
||||
|
||||
b.HasIndex("PartitionId");
|
||||
|
||||
b.ToTable("FilesystemsByLogicalPartition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.Forbidden", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -1217,6 +1238,47 @@ namespace Marechai.Database.Migrations
|
||||
b.ToTable("log");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.LogicalPartition", b =>
|
||||
{
|
||||
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Description").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<ulong>("FirstSector").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("LastSector").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<string>("Name").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<string>("Scheme").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<uint>("Sequence").HasColumnType("int unsigned");
|
||||
|
||||
b.Property<ulong>("Size").HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<string>("Type").IsRequired().HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Description");
|
||||
|
||||
b.HasIndex("FirstSector");
|
||||
|
||||
b.HasIndex("LastSector");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("Scheme");
|
||||
|
||||
b.HasIndex("Type");
|
||||
|
||||
b.ToTable("LogicalPartitions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.Machine", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -2774,6 +2836,15 @@ namespace Marechai.Database.Migrations
|
||||
OnDelete(DeleteBehavior.Cascade).IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.FilesystemsByLogicalPartition", b =>
|
||||
{
|
||||
b.HasOne("Marechai.Database.Models.Filesystem", "Filesystem").WithMany("Partitions").
|
||||
HasForeignKey("FilesystemId").OnDelete(DeleteBehavior.Cascade).IsRequired();
|
||||
|
||||
b.HasOne("Marechai.Database.Models.LogicalPartition", "Partition").WithMany("Filesystems").
|
||||
HasForeignKey("PartitionId").OnDelete(DeleteBehavior.Cascade).IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marechai.Database.Models.Gpu", b =>
|
||||
{
|
||||
b.HasOne("Marechai.Database.Models.Company", "Company").WithMany("Gpus").HasForeignKey("CompanyId").
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
@@ -49,5 +50,7 @@ namespace Marechai.Database.Models
|
||||
public string PublisherIdentifier { get; set; }
|
||||
public string DataPreparerIdentifier { get; set; }
|
||||
public string ApplicationIdentifier { get; set; }
|
||||
|
||||
public virtual ICollection<FilesystemsByLogicalPartition> Partitions { get; set; }
|
||||
}
|
||||
}
|
||||
37
Marechai.Database/Models/FilesystemsByLogicalPartition.cs
Normal file
37
Marechai.Database/Models/FilesystemsByLogicalPartition.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 FilesystemsByLogicalPartition : BaseModel<ulong>
|
||||
{
|
||||
[Required]
|
||||
public virtual Filesystem Filesystem { get; set; }
|
||||
[Required]
|
||||
public virtual LogicalPartition Partition { get; set; }
|
||||
}
|
||||
}
|
||||
45
Marechai.Database/Models/LogicalPartition.cs
Normal file
45
Marechai.Database/Models/LogicalPartition.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
/******************************************************************************
|
||||
// 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.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
{
|
||||
public class LogicalPartition : BaseModel<ulong>
|
||||
{
|
||||
public uint Sequence { get; set; }
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public string Type { get; set; }
|
||||
public ulong FirstSector { get; set; }
|
||||
public ulong LastSector { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Scheme { get; set; }
|
||||
|
||||
public virtual ICollection<FilesystemsByLogicalPartition> Filesystems { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,7 @@ namespace Marechai.Database.Models
|
||||
public virtual DbSet<DbFile> Files { get; set; }
|
||||
public virtual DbSet<FileDataStream> FileDataStreams { get; set; }
|
||||
public virtual DbSet<Filesystem> Filesystems { get; set; }
|
||||
public virtual DbSet<LogicalPartition> LogicalPartitions { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -1637,6 +1638,23 @@ namespace Marechai.Database.Models
|
||||
entity.HasIndex(d => d.DataPreparerIdentifier);
|
||||
entity.HasIndex(d => d.ApplicationIdentifier);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<LogicalPartition>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Description);
|
||||
entity.HasIndex(e => e.Name);
|
||||
entity.HasIndex(e => e.Type);
|
||||
entity.HasIndex(e => e.Scheme);
|
||||
entity.HasIndex(e => e.FirstSector);
|
||||
entity.HasIndex(e => e.LastSector);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<FilesystemsByLogicalPartition>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Partition).WithMany(p => p.Filesystems).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(d => d.Filesystem).WithMany(p => p.Partitions).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>4.0.0.1673</Version>
|
||||
<Version>4.0.0.1677</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