mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add file data streams.
This commit is contained in:
4516
Marechai.Database/Migrations/20200610220719_AddFileDataStreams.Designer.cs
generated
Normal file
4516
Marechai.Database/Migrations/20200610220719_AddFileDataStreams.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -790,6 +790,31 @@ namespace Marechai.Database.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -2672,6 +2697,12 @@ namespace Marechai.Database.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.HasOne("Marechai.Database.Models.Company", "Company").WithMany("Gpus").HasForeignKey("CompanyId").
|
||||
|
||||
38
Marechai.Database/Models/FileDataStream.cs
Normal file
38
Marechai.Database/Models/FileDataStream.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@ namespace Marechai.Database.Models
|
||||
public virtual DbSet<CurrencyPegging> CurrenciesPegging { get; set; }
|
||||
public virtual DbSet<DumpHardware> DumpHardwares { get; set; }
|
||||
public virtual DbSet<DbFile> Files { get; set; }
|
||||
public virtual DbSet<FileDataStream> FileDataStreams { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -1614,6 +1615,12 @@ namespace Marechai.Database.Models
|
||||
entity.HasIndex(e => e.Hack);
|
||||
entity.HasIndex(e => e.HackGroup);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<FileDataStream>(entity =>
|
||||
{
|
||||
entity.HasIndex(d => d.Name);
|
||||
entity.HasIndex(d => d.Size);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>4.0.0.1669</Version>
|
||||
<Version>4.0.0.1671</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