Add file data streams.

This commit is contained in:
2020-06-10 23:47:37 +01:00
parent ae20d34af2
commit d3dee1c841
6 changed files with 4659 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
/******************************************************************************
// 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 AddFileDataStreams : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("FileDataStreams", 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),
Name = table.Column<string>(maxLength: 255, nullable: true),
Size = table.Column<ulong>(nullable: false), FileId = table.Column<ulong>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_FileDataStreams", x => x.Id);
table.ForeignKey("FK_FileDataStreams_Files_FileId", x => x.FileId, "Files", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_FileDataStreams_FileId", "FileDataStreams", "FileId");
migrationBuilder.CreateIndex("IX_FileDataStreams_Name", "FileDataStreams", "Name");
migrationBuilder.CreateIndex("IX_FileDataStreams_Size", "FileDataStreams", "Size");
}
protected override void Down(MigrationBuilder migrationBuilder) =>
migrationBuilder.DropTable("FileDataStreams");
}
}

View File

@@ -790,6 +790,31 @@ namespace Marechai.Database.Migrations
b.ToTable("DumpHardwares"); b.ToTable("DumpHardwares");
}); });
modelBuilder.Entity("Marechai.Database.Models.FileDataStream", b =>
{
b.Property<ulong>("Id").ValueGeneratedOnAdd().HasColumnType("bigint unsigned");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<ulong>("FileId").HasColumnType("bigint unsigned");
b.Property<string>("Name").HasColumnType("varchar(255) CHARACTER SET utf8mb4").HasMaxLength(255);
b.Property<ulong>("Size").HasColumnType("bigint unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("FileId");
b.HasIndex("Name");
b.HasIndex("Size");
b.ToTable("FileDataStreams");
});
modelBuilder.Entity("Marechai.Database.Models.Forbidden", b => modelBuilder.Entity("Marechai.Database.Models.Forbidden", b =>
{ {
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)"); b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
@@ -2672,6 +2697,12 @@ namespace Marechai.Database.Migrations
HasForeignKey("MachineFamilyId").OnDelete(DeleteBehavior.Cascade).IsRequired(); HasForeignKey("MachineFamilyId").OnDelete(DeleteBehavior.Cascade).IsRequired();
}); });
modelBuilder.Entity("Marechai.Database.Models.FileDataStream", b =>
{
b.HasOne("Marechai.Database.Models.DbFile", "File").WithMany().HasForeignKey("FileId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.Gpu", b => modelBuilder.Entity("Marechai.Database.Models.Gpu", b =>
{ {
b.HasOne("Marechai.Database.Models.Company", "Company").WithMany("Gpus").HasForeignKey("CompanyId"). b.HasOne("Marechai.Database.Models.Company", "Company").WithMany("Gpus").HasForeignKey("CompanyId").

View File

@@ -0,0 +1,38 @@
/******************************************************************************
// 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 FileDataStream : BaseModel<ulong>
{
[StringLength(255)]
public string Name { get; set; }
public ulong Size { get; set; }
[Required]
public virtual DbFile File { get; set; }
}
}

View File

@@ -107,6 +107,7 @@ namespace Marechai.Database.Models
public virtual DbSet<CurrencyPegging> CurrenciesPegging { get; set; } public virtual DbSet<CurrencyPegging> CurrenciesPegging { get; set; }
public virtual DbSet<DumpHardware> DumpHardwares { get; set; } public virtual DbSet<DumpHardware> DumpHardwares { get; set; }
public virtual DbSet<DbFile> Files { get; set; } public virtual DbSet<DbFile> Files { get; set; }
public virtual DbSet<FileDataStream> FileDataStreams { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
@@ -1614,6 +1615,12 @@ namespace Marechai.Database.Models
entity.HasIndex(e => e.Hack); entity.HasIndex(e => e.Hack);
entity.HasIndex(e => e.HackGroup); entity.HasIndex(e => e.HackGroup);
}); });
modelBuilder.Entity<FileDataStream>(entity =>
{
entity.HasIndex(d => d.Name);
entity.HasIndex(d => d.Size);
});
} }
} }
} }

View File

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