mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add screens.
This commit is contained in:
5681
Cicm.Database/Migrations/20190601122952_AddScreens.Designer.cs
generated
Normal file
5681
Cicm.Database/Migrations/20190601122952_AddScreens.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
97
Cicm.Database/Migrations/20190601122952_AddScreens.cs
Normal file
97
Cicm.Database/Migrations/20190601122952_AddScreens.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddScreens : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("Screens",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Width = table.Column<double>(nullable: true),
|
||||
Height = table.Column<double>(nullable: true),
|
||||
Diagonal = table.Column<double>(),
|
||||
NativeResolutionId = table.Column<int>(),
|
||||
EffectiveColors = table.Column<long>(nullable: true),
|
||||
Type = table.Column<string>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Screens", x => x.Id);
|
||||
table.ForeignKey("FK_Screens_resolutions_NativeResolutionId",
|
||||
x => x.NativeResolutionId, "resolutions", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("ResolutionsByScreen",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ScreenId = table.Column<int>(),
|
||||
ResolutionId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ResolutionsByScreen", x => x.Id);
|
||||
table.ForeignKey("FK_ResolutionsByScreen_resolutions_ResolutionId",
|
||||
x => x.ResolutionId, "resolutions", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_ResolutionsByScreen_Screens_ScreenId",
|
||||
x => x.ScreenId, "Screens", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("ScreensByMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ScreenId = table.Column<int>(),
|
||||
MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ScreensByMachine", x => x.Id);
|
||||
table.ForeignKey("FK_ScreensByMachine_machines_MachineId",
|
||||
x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_ScreensByMachine_Screens_ScreenId", x => x.ScreenId,
|
||||
"Screens", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_ResolutionsByScreen_ResolutionId", "ResolutionsByScreen", "ResolutionId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_ResolutionsByScreen_ScreenId", "ResolutionsByScreen", "ScreenId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Screens_Diagonal", "Screens", "Diagonal");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Screens_EffectiveColors", "Screens", "EffectiveColors");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Screens_Height", "Screens", "Height");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Screens_NativeResolutionId", "Screens", "NativeResolutionId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Screens_Type", "Screens", "Type");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Screens_Width", "Screens", "Width");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_ScreensByMachine_MachineId", "ScreensByMachine", "MachineId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_ScreensByMachine_ScreenId", "ScreensByMachine", "ScreenId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("ResolutionsByScreen");
|
||||
|
||||
migrationBuilder.DropTable("ScreensByMachine");
|
||||
|
||||
migrationBuilder.DropTable("Screens");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4389,6 +4389,73 @@ namespace Cicm.Database.Migrations
|
||||
b.ToTable("resolutions_by_gpu");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.ResolutionsByScreen", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("ResolutionId");
|
||||
|
||||
b.Property<int>("ScreenId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ResolutionId");
|
||||
|
||||
b.HasIndex("ScreenId");
|
||||
|
||||
b.ToTable("ResolutionsByScreen");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.Screen", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<double>("Diagonal");
|
||||
|
||||
b.Property<long?>("EffectiveColors");
|
||||
|
||||
b.Property<double?>("Height");
|
||||
|
||||
b.Property<int>("NativeResolutionId");
|
||||
|
||||
b.Property<string>("Type").IsRequired();
|
||||
|
||||
b.Property<double?>("Width");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Diagonal");
|
||||
|
||||
b.HasIndex("EffectiveColors");
|
||||
|
||||
b.HasIndex("Height");
|
||||
|
||||
b.HasIndex("NativeResolutionId");
|
||||
|
||||
b.HasIndex("Type");
|
||||
|
||||
b.HasIndex("Width");
|
||||
|
||||
b.ToTable("Screens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.ScreensByMachine", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("MachineId");
|
||||
|
||||
b.Property<int>("ScreenId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.HasIndex("ScreenId");
|
||||
|
||||
b.ToTable("ScreensByMachine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.SoundByMachine", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("bigint(20)");
|
||||
@@ -4835,6 +4902,31 @@ namespace Cicm.Database.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.ResolutionsByScreen", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Resolution", "Resolution").WithMany("ResolutionsByScreen")
|
||||
.HasForeignKey("ResolutionId").OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.Screen", "Screen").WithMany("Resolutions").HasForeignKey("ScreenId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.Screen",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Resolution", "NativeResolution").WithMany("Screens")
|
||||
.HasForeignKey("NativeResolutionId").OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.ScreensByMachine", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Machine", "Machine").WithMany("Screens").HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.Screen", "Screen").WithMany("ScreensByMachines")
|
||||
.HasForeignKey("ScreenId").OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.SoundByMachine", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Machine", "Machine").WithMany("Sound").HasForeignKey("MachineId")
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace Cicm.Database.Models
|
||||
public virtual ICollection<SoundByMachine> Sound { get; set; }
|
||||
public virtual ICollection<StorageByMachine> Storage { get; set; }
|
||||
public virtual ICollection<MachinePhoto> Photos { get; set; }
|
||||
public virtual ICollection<ScreensByMachine> Screens { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[DisplayName("Introduced")]
|
||||
|
||||
@@ -56,7 +56,9 @@ namespace Cicm.Database.Models
|
||||
[DisplayName("Grayscale")]
|
||||
public bool Grayscale { get; set; }
|
||||
|
||||
public virtual ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
|
||||
public virtual ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
|
||||
public virtual ICollection<ResolutionsByScreen> ResolutionsByScreen { get; set; }
|
||||
public virtual ICollection<Screen> Screens { get; set; }
|
||||
|
||||
public long? PaletteView => Palette ?? Colors;
|
||||
|
||||
|
||||
47
Cicm.Database/Models/ResolutionsByScreen.cs
Normal file
47
Cicm.Database/Models/ResolutionsByScreen.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : ResolutionsByGpu.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Junction of resolutions and gpus.
|
||||
//
|
||||
// --[ 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-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class ResolutionsByScreen : BaseModel<long>
|
||||
{
|
||||
[Remote("VerifyUnique", "ResolutionsByScreen", "Admin", AdditionalFields = nameof(ResolutionId))]
|
||||
public int ScreenId { get; set; }
|
||||
[Remote("VerifyUnique", "ResolutionsByScreen", "Admin", AdditionalFields = nameof(ScreenId))]
|
||||
public int ResolutionId { get; set; }
|
||||
|
||||
[DisplayName("GPU")]
|
||||
public virtual Screen Screen { get; set; }
|
||||
public virtual Resolution Resolution { get; set; }
|
||||
}
|
||||
}
|
||||
28
Cicm.Database/Models/Screen.cs
Normal file
28
Cicm.Database/Models/Screen.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class Screen : BaseModel<int>
|
||||
{
|
||||
[Range(1, 131072)]
|
||||
public double? Width { get; set; }
|
||||
[Range(1, 131072)]
|
||||
public double? Height { get; set; }
|
||||
[Required]
|
||||
public double Diagonal { get; set; }
|
||||
[Required]
|
||||
public virtual Resolution NativeResolution { get; set; }
|
||||
[Range(2, 281474976710656)]
|
||||
public long? EffectiveColors { get; set; }
|
||||
[Required]
|
||||
public string Type { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public long? Colors => EffectiveColors ?? NativeResolution.Colors;
|
||||
|
||||
public virtual ICollection<ResolutionsByScreen> Resolutions { get; set; }
|
||||
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
|
||||
}
|
||||
}
|
||||
47
Cicm.Database/Models/ScreensByMachine.cs
Normal file
47
Cicm.Database/Models/ScreensByMachine.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : ResolutionsByGpu.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Junction of resolutions and gpus.
|
||||
//
|
||||
// --[ 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-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class ScreensByMachine : BaseModel<long>
|
||||
{
|
||||
[Remote("VerifyUnique", "ScreensByMachine", "Admin", AdditionalFields = nameof(MachineId))]
|
||||
public int ScreenId { get; set; }
|
||||
[Remote("VerifyUnique", "ScreensByMachine", "Admin", AdditionalFields = nameof(ScreenId))]
|
||||
public int MachineId { get; set; }
|
||||
|
||||
[DisplayName("GPU")]
|
||||
public virtual Screen Screen { get; set; }
|
||||
public virtual Machine Machine { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,9 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<ProcessorsByOwnedMachine> ProcessorsByOwnedMachine { get; set; }
|
||||
public virtual DbSet<SoundByOwnedMachine> SoundByOwnedMachine { get; set; }
|
||||
public virtual DbSet<StorageByOwnedMachine> StorageByOwnedMachine { get; set; }
|
||||
public virtual DbSet<Screen> Screens { get; set; }
|
||||
public virtual DbSet<ScreensByMachine> ScreensByMachine { get; set; }
|
||||
public virtual DbSet<ResolutionsByScreen> ResolutionsByScreen { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -950,6 +953,35 @@ namespace Cicm.Database.Models
|
||||
.HasConstraintName("fk_resolutions_by_gpu_resolution");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ResolutionsByScreen>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ScreenId);
|
||||
|
||||
entity.HasIndex(e => e.ResolutionId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ScreensByMachine>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ScreenId);
|
||||
|
||||
entity.HasIndex(e => e.MachineId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Screen>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Width);
|
||||
|
||||
entity.HasIndex(e => e.Height);
|
||||
|
||||
entity.HasIndex(e => e.Diagonal);
|
||||
|
||||
entity.HasIndex(e => e.EffectiveColors);
|
||||
|
||||
entity.HasIndex(e => e.Type);
|
||||
|
||||
entity.HasOne(d => d.NativeResolution).WithMany(p => p.Screens);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<SoundByMachine>(entity =>
|
||||
{
|
||||
entity.ToTable("sound_by_machine");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.704</Version>
|
||||
<Version>3.0.99.710</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user