Move old owned_computers and owned_consoles tables to a new OwnedMachines table

with corresponding GPUs, memory, processors, sound synths and storage related tables.
This commit is contained in:
2019-05-29 21:13:09 +01:00
parent b27d67604f
commit 3813ad80cf
17 changed files with 6677 additions and 303 deletions

View File

@@ -47,6 +47,7 @@ namespace Cicm.Database
public enum StatusType
{
Unknown = 0,
TestedGood = 1,
NotTested = 2,
TestedBad = 3

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,493 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Cicm.Database.Migrations
{
public partial class AddOwnedMachines : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("OwnedMachines",
table => new
{
Id =
table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
AcquisitionDate = table.Column<DateTime>(),
LostDate = table.Column<DateTime>(nullable: true),
Status = table.Column<int>(),
LastStatusDate = table.Column<DateTime>(nullable: true),
Trade = table.Column<bool>(),
Boxed = table.Column<bool>(),
Manuals = table.Column<bool>(),
SerialNumber = table.Column<string>(nullable: true),
SerialNumberVisible =
table.Column<bool>(nullable: false, defaultValue: true),
MachineId = table.Column<int>(),
UserId = table.Column<string>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_OwnedMachines", x => x.Id);
table.ForeignKey("FK_OwnedMachines_machines_MachineId", x => x.MachineId,
"machines", "id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_OwnedMachines_AspNetUsers_UserId", x => x.UserId,
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("GpusByOwnedMachine",
table => new
{
Id = table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
GpuId = table.Column<int>(),
OwnedMachineId = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_GpusByOwnedMachine", x => x.Id);
table.ForeignKey("FK_GpusByOwnedMachine_gpus_GpuId", x => x.GpuId, "gpus",
"id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_GpusByOwnedMachine_OwnedMachines_OwnedMachineId",
x => x.OwnedMachineId, "OwnedMachines", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("MemoryByOwnedMachine",
table => new
{
Id = table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
OwnedMachineId = table.Column<long>(),
Type = table.Column<int>(),
Usage = table.Column<int>(),
Size = table.Column<long>(),
Speed = table.Column<double>()
}, constraints: table =>
{
table.PrimaryKey("PK_MemoryByOwnedMachine", x => x.Id);
table.ForeignKey("FK_MemoryByOwnedMachine_OwnedMachines_OwnedMachineId",
x => x.OwnedMachineId, "OwnedMachines", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("OwnedMachinePhotos",
table => new
{
Id = table.Column<Guid>(),
Author = table.Column<string>(nullable: true),
CameraManufacturer = table.Column<string>(nullable: true),
CameraModel = table.Column<string>(nullable: true),
ColorSpace = table.Column<ushort>(nullable: true),
Comments = table.Column<string>(nullable: true),
Contrast = table.Column<ushort>(nullable: true),
CreationDate = table.Column<DateTime>(nullable: true),
DigitalZoomRatio = table.Column<double>(nullable: true),
ExifVersion = table.Column<string>(nullable: true),
Exposure = table.Column<string>(nullable: true),
ExposureMethod = table.Column<ushort>(nullable: true),
ExposureProgram = table.Column<ushort>(nullable: true),
Flash = table.Column<ushort>(nullable: true),
Focal = table.Column<double>(nullable: true),
FocalLength = table.Column<double>(nullable: true),
FocalLengthEquivalent = table.Column<ushort>(nullable: true),
HorizontalResolution = table.Column<double>(nullable: true),
IsoRating = table.Column<ushort>(nullable: true),
Lens = table.Column<string>(nullable: true),
LightSource = table.Column<ushort>(nullable: true),
MeteringMode = table.Column<ushort>(nullable: true),
ResolutionUnit = table.Column<ushort>(nullable: true),
Orientation = table.Column<ushort>(nullable: true),
Saturation = table.Column<ushort>(nullable: true),
SceneCaptureType = table.Column<ushort>(nullable: true),
SensingMethod = table.Column<ushort>(nullable: true),
Sharpness = table.Column<ushort>(nullable: true),
SoftwareUsed = table.Column<string>(nullable: true),
SubjectDistanceRange = table.Column<ushort>(nullable: true),
UploadDate =
table.Column<DateTime>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
VerticalResolution = table.Column<double>(nullable: true),
WhiteBalance = table.Column<ushort>(nullable: true),
UserId = table.Column<string>(nullable: true),
LicenseId = table.Column<int>(),
OwnedMachineId = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_OwnedMachinePhotos", x => x.Id);
table.ForeignKey("FK_OwnedMachinePhotos_Licenses_LicenseId",
x => x.LicenseId, "Licenses", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_OwnedMachinePhotos_OwnedMachines_OwnedMachineId",
x => x.OwnedMachineId, "OwnedMachines", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_OwnedMachinePhotos_AspNetUsers_UserId", x => x.UserId,
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("ProcessorsByOwnedMachine",
table => new
{
Id = table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
ProcessorId = table.Column<int>(),
OwnedMachineId = table.Column<long>(),
Speed = table.Column<float>()
}, constraints: table =>
{
table.PrimaryKey("PK_ProcessorsByOwnedMachine", x => x.Id);
table
.ForeignKey("FK_ProcessorsByOwnedMachine_OwnedMachines_OwnedMachineId",
x => x.OwnedMachineId, "OwnedMachines", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_ProcessorsByOwnedMachine_processors_ProcessorId",
x => x.ProcessorId, "processors", "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("SoundByOwnedMachine",
table => new
{
Id = table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
SoundSynthId = table.Column<int>(),
OwnedMachineId = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_SoundByOwnedMachine", x => x.Id);
table.ForeignKey("FK_SoundByOwnedMachine_OwnedMachines_OwnedMachineId",
x => x.OwnedMachineId, "OwnedMachines", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_SoundByOwnedMachine_sound_synths_SoundSynthId",
x => x.SoundSynthId, "sound_synths", "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable("StorageByOwnedMachine",
table => new
{
Id = table.Column<long>()
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
OwnedMachineId = table.Column<long>(),
Type = table.Column<int>(),
Interface = table.Column<int>(),
Capacity = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_StorageByOwnedMachine", x => x.Id);
table.ForeignKey("FK_StorageByOwnedMachine_OwnedMachines_OwnedMachineId",
x => x.OwnedMachineId, "OwnedMachines", "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex("IX_GpusByOwnedMachine_GpuId", "GpusByOwnedMachine", "GpuId");
migrationBuilder.CreateIndex("IX_GpusByOwnedMachine_OwnedMachineId", "GpusByOwnedMachine",
"OwnedMachineId");
migrationBuilder.CreateIndex("IX_MemoryByOwnedMachine_OwnedMachineId", "MemoryByOwnedMachine",
"OwnedMachineId");
migrationBuilder.CreateIndex("IX_MemoryByOwnedMachine_Size", "MemoryByOwnedMachine", "Size");
migrationBuilder.CreateIndex("IX_MemoryByOwnedMachine_Speed", "MemoryByOwnedMachine", "Speed");
migrationBuilder.CreateIndex("IX_MemoryByOwnedMachine_Type", "MemoryByOwnedMachine", "Type");
migrationBuilder.CreateIndex("IX_MemoryByOwnedMachine_Usage", "MemoryByOwnedMachine", "Usage");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Author", "OwnedMachinePhotos", "Author");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_CameraManufacturer", "OwnedMachinePhotos",
"CameraManufacturer");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_CameraModel", "OwnedMachinePhotos", "CameraModel");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_ColorSpace", "OwnedMachinePhotos", "ColorSpace");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Comments", "OwnedMachinePhotos", "Comments");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Contrast", "OwnedMachinePhotos", "Contrast");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_CreationDate", "OwnedMachinePhotos", "CreationDate");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_DigitalZoomRatio", "OwnedMachinePhotos",
"DigitalZoomRatio");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_ExifVersion", "OwnedMachinePhotos", "ExifVersion");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Exposure", "OwnedMachinePhotos", "Exposure");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_ExposureMethod", "OwnedMachinePhotos",
"ExposureMethod");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_ExposureProgram", "OwnedMachinePhotos",
"ExposureProgram");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Flash", "OwnedMachinePhotos", "Flash");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Focal", "OwnedMachinePhotos", "Focal");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_FocalLength", "OwnedMachinePhotos", "FocalLength");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_FocalLengthEquivalent", "OwnedMachinePhotos",
"FocalLengthEquivalent");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_HorizontalResolution", "OwnedMachinePhotos",
"HorizontalResolution");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_IsoRating", "OwnedMachinePhotos", "IsoRating");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Lens", "OwnedMachinePhotos", "Lens");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_LicenseId", "OwnedMachinePhotos", "LicenseId");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_LightSource", "OwnedMachinePhotos", "LightSource");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_MeteringMode", "OwnedMachinePhotos", "MeteringMode");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Orientation", "OwnedMachinePhotos", "Orientation");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_OwnedMachineId", "OwnedMachinePhotos",
"OwnedMachineId");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_ResolutionUnit", "OwnedMachinePhotos",
"ResolutionUnit");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Saturation", "OwnedMachinePhotos", "Saturation");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_SceneCaptureType", "OwnedMachinePhotos",
"SceneCaptureType");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_SensingMethod", "OwnedMachinePhotos", "SensingMethod");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Sharpness", "OwnedMachinePhotos", "Sharpness");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_SoftwareUsed", "OwnedMachinePhotos", "SoftwareUsed");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_SubjectDistanceRange", "OwnedMachinePhotos",
"SubjectDistanceRange");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_UploadDate", "OwnedMachinePhotos", "UploadDate");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_UserId", "OwnedMachinePhotos", "UserId");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_VerticalResolution", "OwnedMachinePhotos",
"VerticalResolution");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_WhiteBalance", "OwnedMachinePhotos", "WhiteBalance");
migrationBuilder.CreateIndex("IX_OwnedMachines_AcquisitionDate", "OwnedMachines", "AcquisitionDate");
migrationBuilder.CreateIndex("IX_OwnedMachines_Boxed", "OwnedMachines", "Boxed");
migrationBuilder.CreateIndex("IX_OwnedMachines_LastStatusDate", "OwnedMachines", "LastStatusDate");
migrationBuilder.CreateIndex("IX_OwnedMachines_LostDate", "OwnedMachines", "LostDate");
migrationBuilder.CreateIndex("IX_OwnedMachines_MachineId", "OwnedMachines", "MachineId");
migrationBuilder.CreateIndex("IX_OwnedMachines_Manuals", "OwnedMachines", "Manuals");
migrationBuilder.CreateIndex("IX_OwnedMachines_SerialNumber", "OwnedMachines", "SerialNumber");
migrationBuilder.CreateIndex("IX_OwnedMachines_SerialNumberVisible", "OwnedMachines",
"SerialNumberVisible");
migrationBuilder.CreateIndex("IX_OwnedMachines_Status", "OwnedMachines", "Status");
migrationBuilder.CreateIndex("IX_OwnedMachines_Trade", "OwnedMachines", "Trade");
migrationBuilder.CreateIndex("IX_OwnedMachines_UserId", "OwnedMachines", "UserId");
migrationBuilder.CreateIndex("IX_ProcessorsByOwnedMachine_OwnedMachineId", "ProcessorsByOwnedMachine",
"OwnedMachineId");
migrationBuilder.CreateIndex("IX_ProcessorsByOwnedMachine_ProcessorId", "ProcessorsByOwnedMachine",
"ProcessorId");
migrationBuilder.CreateIndex("IX_ProcessorsByOwnedMachine_Speed", "ProcessorsByOwnedMachine", "Speed");
migrationBuilder.CreateIndex("IX_SoundByOwnedMachine_OwnedMachineId", "SoundByOwnedMachine",
"OwnedMachineId");
migrationBuilder.CreateIndex("IX_SoundByOwnedMachine_SoundSynthId", "SoundByOwnedMachine", "SoundSynthId");
migrationBuilder.CreateIndex("IX_StorageByOwnedMachine_Capacity", "StorageByOwnedMachine", "Capacity");
migrationBuilder.CreateIndex("IX_StorageByOwnedMachine_Interface", "StorageByOwnedMachine", "Interface");
migrationBuilder.CreateIndex("IX_StorageByOwnedMachine_OwnedMachineId", "StorageByOwnedMachine",
"OwnedMachineId");
migrationBuilder.CreateIndex("IX_StorageByOwnedMachine_Type", "StorageByOwnedMachine", "Type");
migrationBuilder.Sql(@"SELECT Id INTO @userId FROM AspNetUsers LIMIT 1;
INSERT INTO OwnedMachines (AcquisitionDate, Status, Trade, Boxed, Manuals, MachineId, UserId)
SELECT a.date, a.status, a.trade, a.boxed, a.manuals, a.db_id, @userId FROM owned_computers AS a;");
migrationBuilder.DropTable("owned_computers");
migrationBuilder.Sql(@"SELECT Id INTO @userId FROM AspNetUsers LIMIT 1;
INSERT INTO OwnedMachines (AcquisitionDate, Status, Trade, Boxed, Manuals, MachineId, UserId)
SELECT a.date, a.status, a.trade, a.boxed, a.manuals, a.db_id + 356, @userId FROM owned_consoles AS a;");
migrationBuilder.DropTable("owned_consoles");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("GpusByOwnedMachine");
migrationBuilder.DropTable("MemoryByOwnedMachine");
migrationBuilder.DropTable("OwnedMachinePhotos");
migrationBuilder.DropTable("ProcessorsByOwnedMachine");
migrationBuilder.DropTable("SoundByOwnedMachine");
migrationBuilder.DropTable("StorageByOwnedMachine");
migrationBuilder.DropTable("OwnedMachines");
migrationBuilder.CreateTable("owned_computers",
table => new
{
id =
table.Column<int>("int(11)")
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
boxed =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
cap1 =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
cap2 =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
cpu1 =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
cpu2 =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
date =
table.Column<string>("varchar(20)", nullable: false,
defaultValueSql: "''"),
db_id =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
disk1 =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
disk2 =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
manuals =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
mhz1 =
table.Column<decimal>("decimal(10,0)", nullable: false,
defaultValueSql: "'0'"),
mhz2 =
table.Column<decimal>("decimal(10,0)", nullable: false,
defaultValueSql: "'0'"),
ram =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
rigid =
table.Column<string>("varchar(64)", nullable: false,
defaultValueSql: "''"),
status =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
trade = table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
vram = table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'")
},
constraints: table => { table.PrimaryKey("PK_owned_computers", x => x.id); });
migrationBuilder.CreateTable("owned_consoles",
table => new
{
id =
table.Column<int>("int(11)")
.Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
boxed =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
date =
table.Column<string>("char(20)", nullable: false,
defaultValueSql: "''"),
db_id =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
manuals =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
status =
table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'"),
trade = table.Column<int>("int(11)", nullable: false,
defaultValueSql: "'0'")
},
constraints: table => { table.PrimaryKey("PK_owned_consoles", x => x.id); });
migrationBuilder.CreateIndex("idx_owned_computers_boxed", "owned_computers", "boxed");
migrationBuilder.CreateIndex("idx_owned_computers_cap1", "owned_computers", "cap1");
migrationBuilder.CreateIndex("idx_owned_computers_cap2", "owned_computers", "cap2");
migrationBuilder.CreateIndex("idx_owned_computers_cpu1", "owned_computers", "cpu1");
migrationBuilder.CreateIndex("idx_owned_computers_cpu2", "owned_computers", "cpu2");
migrationBuilder.CreateIndex("idx_owned_computers_date", "owned_computers", "date");
migrationBuilder.CreateIndex("idx_owned_computers_db_id", "owned_computers", "db_id");
migrationBuilder.CreateIndex("idx_owned_computers_disk1", "owned_computers", "disk1");
migrationBuilder.CreateIndex("idx_owned_computers_disk2", "owned_computers", "disk2");
migrationBuilder.CreateIndex("idx_owned_computers_manuals", "owned_computers", "manuals");
migrationBuilder.CreateIndex("idx_owned_computers_mhz1", "owned_computers", "mhz1");
migrationBuilder.CreateIndex("idx_owned_computers_mhz2", "owned_computers", "mhz2");
migrationBuilder.CreateIndex("idx_owned_computers_ram", "owned_computers", "ram");
migrationBuilder.CreateIndex("idx_owned_computers_rigid", "owned_computers", "rigid");
migrationBuilder.CreateIndex("idx_owned_computers_status", "owned_computers", "status");
migrationBuilder.CreateIndex("idx_owned_computers_trade", "owned_computers", "trade");
migrationBuilder.CreateIndex("idx_owned_computers_vram", "owned_computers", "vram");
migrationBuilder.CreateIndex("idx_owned_consoles_boxed", "owned_consoles", "boxed");
migrationBuilder.CreateIndex("idx_owned_consoles_date", "owned_consoles", "date");
migrationBuilder.CreateIndex("idx_owned_consoles_db_id", "owned_consoles", "db_id");
migrationBuilder.CreateIndex("idx_owned_consoles_manuals", "owned_consoles", "manuals");
migrationBuilder.CreateIndex("idx_owned_consoles_status", "owned_consoles", "status");
migrationBuilder.CreateIndex("idx_owned_consoles_trade", "owned_consoles", "trade");
}
}
}

View File

@@ -293,6 +293,23 @@ namespace Cicm.Database.Migrations
b.ToTable("gpus_by_machine");
});
modelBuilder.Entity("Cicm.Database.Models.GpusByOwnedMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd();
b.Property<int>("GpuId");
b.Property<long>("OwnedMachineId");
b.HasKey("Id");
b.HasIndex("GpuId");
b.HasIndex("OwnedMachineId");
b.ToTable("GpusByOwnedMachine");
});
modelBuilder.Entity("Cicm.Database.Models.InstructionSet", b =>
{
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
@@ -3890,6 +3907,35 @@ namespace Cicm.Database.Migrations
b.ToTable("memory_by_machine");
});
modelBuilder.Entity("Cicm.Database.Models.MemoryByOwnedMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd();
b.Property<long>("OwnedMachineId");
b.Property<long>("Size");
b.Property<double>("Speed");
b.Property<int>("Type");
b.Property<int>("Usage");
b.HasKey("Id");
b.HasIndex("OwnedMachineId");
b.HasIndex("Size");
b.HasIndex("Speed");
b.HasIndex("Type");
b.HasIndex("Usage");
b.ToTable("MemoryByOwnedMachine");
});
modelBuilder.Entity("Cicm.Database.Models.MoneyDonation", b =>
{
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
@@ -3932,137 +3978,206 @@ namespace Cicm.Database.Migrations
b.ToTable("news");
});
modelBuilder.Entity("Cicm.Database.Models.OwnedComputer", b =>
modelBuilder.Entity("Cicm.Database.Models.OwnedMachine", b =>
{
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
b.Property<long>("Id").ValueGeneratedOnAdd();
b.Property<int>("Boxed").ValueGeneratedOnAdd().HasColumnName("boxed").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<DateTime>("AcquisitionDate");
b.Property<int>("Cap1").ValueGeneratedOnAdd().HasColumnName("cap1").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<bool>("Boxed");
b.Property<int>("Cap2").ValueGeneratedOnAdd().HasColumnName("cap2").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<DateTime?>("LastStatusDate");
b.Property<int>("Cpu1").ValueGeneratedOnAdd().HasColumnName("cpu1").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<DateTime?>("LostDate");
b.Property<int>("Cpu2").ValueGeneratedOnAdd().HasColumnName("cpu2").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<int>("MachineId");
b.Property<string>("Date").IsRequired().ValueGeneratedOnAdd().HasColumnName("date")
.HasColumnType("varchar(20)").HasDefaultValueSql("''");
b.Property<bool>("Manuals");
b.Property<int>("DbId").ValueGeneratedOnAdd().HasColumnName("db_id").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("SerialNumber");
b.Property<int>("Disk1").ValueGeneratedOnAdd().HasColumnName("disk1").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<bool>("SerialNumberVisible").ValueGeneratedOnAdd().HasDefaultValue(true);
b.Property<int>("Disk2").ValueGeneratedOnAdd().HasColumnName("disk2").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<int>("Status");
b.Property<int>("Manuals").ValueGeneratedOnAdd().HasColumnName("manuals").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<bool>("Trade");
b.Property<decimal>("Mhz1").ValueGeneratedOnAdd().HasColumnName("mhz1").HasColumnType("decimal(10,0)")
.HasDefaultValueSql("'0'");
b.Property<decimal>("Mhz2").ValueGeneratedOnAdd().HasColumnName("mhz2").HasColumnType("decimal(10,0)")
.HasDefaultValueSql("'0'");
b.Property<int>("Ram").ValueGeneratedOnAdd().HasColumnName("ram").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("Rigid").IsRequired().ValueGeneratedOnAdd().HasColumnName("rigid")
.HasColumnType("varchar(64)").HasDefaultValueSql("''");
b.Property<int>("Status").ValueGeneratedOnAdd().HasColumnName("status").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<int>("Trade").ValueGeneratedOnAdd().HasColumnName("trade").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<int>("Vram").ValueGeneratedOnAdd().HasColumnName("vram").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("UserId");
b.HasKey("Id");
b.HasIndex("Boxed").HasName("idx_owned_computers_boxed");
b.HasIndex("AcquisitionDate");
b.HasIndex("Cap1").HasName("idx_owned_computers_cap1");
b.HasIndex("Boxed");
b.HasIndex("Cap2").HasName("idx_owned_computers_cap2");
b.HasIndex("LastStatusDate");
b.HasIndex("Cpu1").HasName("idx_owned_computers_cpu1");
b.HasIndex("LostDate");
b.HasIndex("Cpu2").HasName("idx_owned_computers_cpu2");
b.HasIndex("MachineId");
b.HasIndex("Date").HasName("idx_owned_computers_date");
b.HasIndex("Manuals");
b.HasIndex("DbId").HasName("idx_owned_computers_db_id");
b.HasIndex("SerialNumber");
b.HasIndex("Disk1").HasName("idx_owned_computers_disk1");
b.HasIndex("SerialNumberVisible");
b.HasIndex("Disk2").HasName("idx_owned_computers_disk2");
b.HasIndex("Status");
b.HasIndex("Manuals").HasName("idx_owned_computers_manuals");
b.HasIndex("Trade");
b.HasIndex("Mhz1").HasName("idx_owned_computers_mhz1");
b.HasIndex("UserId");
b.HasIndex("Mhz2").HasName("idx_owned_computers_mhz2");
b.HasIndex("Ram").HasName("idx_owned_computers_ram");
b.HasIndex("Rigid").HasName("idx_owned_computers_rigid");
b.HasIndex("Status").HasName("idx_owned_computers_status");
b.HasIndex("Trade").HasName("idx_owned_computers_trade");
b.HasIndex("Vram").HasName("idx_owned_computers_vram");
b.ToTable("owned_computers");
b.ToTable("OwnedMachines");
});
modelBuilder.Entity("Cicm.Database.Models.OwnedConsole", b =>
modelBuilder.Entity("Cicm.Database.Models.OwnedMachinePhoto", b =>
{
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
b.Property<Guid>("Id").ValueGeneratedOnAdd();
b.Property<int>("Boxed").ValueGeneratedOnAdd().HasColumnName("boxed").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("Author");
b.Property<string>("Date").IsRequired().ValueGeneratedOnAdd().HasColumnName("date")
.HasColumnType("char(20)").HasDefaultValueSql("''");
b.Property<string>("CameraManufacturer");
b.Property<int>("DbId").ValueGeneratedOnAdd().HasColumnName("db_id").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("CameraModel");
b.Property<int>("Manuals").ValueGeneratedOnAdd().HasColumnName("manuals").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<ushort?>("ColorSpace");
b.Property<int>("Status").ValueGeneratedOnAdd().HasColumnName("status").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("Comments");
b.Property<int>("Trade").ValueGeneratedOnAdd().HasColumnName("trade").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<ushort?>("Contrast");
b.Property<DateTime?>("CreationDate");
b.Property<double?>("DigitalZoomRatio");
b.Property<string>("ExifVersion");
b.Property<string>("Exposure");
b.Property<ushort?>("ExposureMethod");
b.Property<ushort?>("ExposureProgram");
b.Property<ushort?>("Flash");
b.Property<double?>("Focal");
b.Property<double?>("FocalLength");
b.Property<ushort?>("FocalLengthEquivalent");
b.Property<double?>("HorizontalResolution");
b.Property<ushort?>("IsoRating");
b.Property<string>("Lens");
b.Property<int>("LicenseId");
b.Property<ushort?>("LightSource");
b.Property<ushort?>("MeteringMode");
b.Property<ushort?>("Orientation");
b.Property<long>("OwnedMachineId");
b.Property<ushort?>("ResolutionUnit");
b.Property<ushort?>("Saturation");
b.Property<ushort?>("SceneCaptureType");
b.Property<ushort?>("SensingMethod");
b.Property<ushort?>("Sharpness");
b.Property<string>("SoftwareUsed");
b.Property<ushort?>("SubjectDistanceRange");
b.Property<DateTime>("UploadDate").IsConcurrencyToken().ValueGeneratedOnAddOrUpdate();
b.Property<string>("UserId");
b.Property<double?>("VerticalResolution");
b.Property<ushort?>("WhiteBalance");
b.HasKey("Id");
b.HasIndex("Boxed").HasName("idx_owned_consoles_boxed");
b.HasIndex("Author");
b.HasIndex("Date").HasName("idx_owned_consoles_date");
b.HasIndex("CameraManufacturer");
b.HasIndex("DbId").HasName("idx_owned_consoles_db_id");
b.HasIndex("CameraModel");
b.HasIndex("Manuals").HasName("idx_owned_consoles_manuals");
b.HasIndex("ColorSpace");
b.HasIndex("Status").HasName("idx_owned_consoles_status");
b.HasIndex("Comments");
b.HasIndex("Trade").HasName("idx_owned_consoles_trade");
b.HasIndex("Contrast");
b.ToTable("owned_consoles");
b.HasIndex("CreationDate");
b.HasIndex("DigitalZoomRatio");
b.HasIndex("ExifVersion");
b.HasIndex("Exposure");
b.HasIndex("ExposureMethod");
b.HasIndex("ExposureProgram");
b.HasIndex("Flash");
b.HasIndex("Focal");
b.HasIndex("FocalLength");
b.HasIndex("FocalLengthEquivalent");
b.HasIndex("HorizontalResolution");
b.HasIndex("IsoRating");
b.HasIndex("Lens");
b.HasIndex("LicenseId");
b.HasIndex("LightSource");
b.HasIndex("MeteringMode");
b.HasIndex("Orientation");
b.HasIndex("OwnedMachineId");
b.HasIndex("ResolutionUnit");
b.HasIndex("Saturation");
b.HasIndex("SceneCaptureType");
b.HasIndex("SensingMethod");
b.HasIndex("Sharpness");
b.HasIndex("SoftwareUsed");
b.HasIndex("SubjectDistanceRange");
b.HasIndex("UploadDate");
b.HasIndex("UserId");
b.HasIndex("VerticalResolution");
b.HasIndex("WhiteBalance");
b.ToTable("OwnedMachinePhotos");
});
modelBuilder.Entity("Cicm.Database.Models.Processor", b =>
@@ -4197,6 +4312,27 @@ namespace Cicm.Database.Migrations
b.ToTable("processors_by_machine");
});
modelBuilder.Entity("Cicm.Database.Models.ProcessorsByOwnedMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd();
b.Property<long>("OwnedMachineId");
b.Property<int>("ProcessorId");
b.Property<float>("Speed");
b.HasKey("Id");
b.HasIndex("OwnedMachineId");
b.HasIndex("ProcessorId");
b.HasIndex("Speed");
b.ToTable("ProcessorsByOwnedMachine");
});
modelBuilder.Entity("Cicm.Database.Models.Resolution", b =>
{
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
@@ -4270,6 +4406,23 @@ namespace Cicm.Database.Migrations
b.ToTable("sound_by_machine");
});
modelBuilder.Entity("Cicm.Database.Models.SoundByOwnedMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd();
b.Property<long>("OwnedMachineId");
b.Property<int>("SoundSynthId");
b.HasKey("Id");
b.HasIndex("OwnedMachineId");
b.HasIndex("SoundSynthId");
b.ToTable("SoundByOwnedMachine");
});
modelBuilder.Entity("Cicm.Database.Models.SoundSynth", b =>
{
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
@@ -4348,6 +4501,31 @@ namespace Cicm.Database.Migrations
b.ToTable("storage_by_machine");
});
modelBuilder.Entity("Cicm.Database.Models.StorageByOwnedMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd();
b.Property<long>("Capacity");
b.Property<int>("Interface");
b.Property<long>("OwnedMachineId");
b.Property<int>("Type");
b.HasKey("Id");
b.HasIndex("Capacity");
b.HasIndex("Interface");
b.HasIndex("OwnedMachineId");
b.HasIndex("Type");
b.ToTable("StorageByOwnedMachine");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id").ValueGeneratedOnAdd();
@@ -4535,6 +4713,15 @@ namespace Cicm.Database.Migrations
.HasConstraintName("fk_gpus_by_machine_machine").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.GpusByOwnedMachine", b =>
{
b.HasOne("Cicm.Database.Models.Gpu", "Gpu").WithMany().HasForeignKey("GpuId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Cicm.Database.Models.OwnedMachine", "OwnedMachine").WithMany("Gpus")
.HasForeignKey("OwnedMachineId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.InstructionSetExtensionsByProcessor", b =>
{
b.HasOne("Cicm.Database.Models.InstructionSetExtension", "Extension")
@@ -4582,6 +4769,34 @@ namespace Cicm.Database.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.MemoryByOwnedMachine",
b =>
{
b.HasOne("Cicm.Database.Models.OwnedMachine", "OwnedMachine").WithMany("Memory")
.HasForeignKey("OwnedMachineId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.OwnedMachine", b =>
{
b.HasOne("Cicm.Database.Models.Machine", "Machine").WithMany().HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Cicm.Database.Models.ApplicationUser", "User").WithMany("OwnedMachines")
.HasForeignKey("UserId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.OwnedMachinePhoto", b =>
{
b.HasOne("Cicm.Database.Models.License", "License").WithMany("OwnedMachinePhotos")
.HasForeignKey("LicenseId").OnDelete(DeleteBehavior.Cascade);
b.HasOne("Cicm.Database.Models.OwnedMachine", "OwnedMachine").WithMany("Photos")
.HasForeignKey("OwnedMachineId").OnDelete(DeleteBehavior.Cascade);
b.HasOne("Cicm.Database.Models.ApplicationUser", "User").WithMany("OwnedMachinePhotos")
.HasForeignKey("UserId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.Processor", b =>
{
b.HasOne("Cicm.Database.Models.Company", "Company").WithMany("Processors").HasForeignKey("CompanyId")
@@ -4601,6 +4816,15 @@ namespace Cicm.Database.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.ProcessorsByOwnedMachine", b =>
{
b.HasOne("Cicm.Database.Models.OwnedMachine", "OwnedMachine").WithMany("Processors")
.HasForeignKey("OwnedMachineId").OnDelete(DeleteBehavior.Cascade);
b.HasOne("Cicm.Database.Models.Processor", "Processor").WithMany().HasForeignKey("ProcessorId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.ResolutionsByGpu", b =>
{
b.HasOne("Cicm.Database.Models.Gpu", "Gpu").WithMany("ResolutionsByGpu").HasForeignKey("GpuId")
@@ -4621,6 +4845,15 @@ namespace Cicm.Database.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.SoundByOwnedMachine", b =>
{
b.HasOne("Cicm.Database.Models.OwnedMachine", "OwnedMachine").WithMany("Sound")
.HasForeignKey("OwnedMachineId").OnDelete(DeleteBehavior.Cascade);
b.HasOne("Cicm.Database.Models.SoundSynth", "SoundSynth").WithMany().HasForeignKey("SoundSynthId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.SoundSynth",
b =>
{
@@ -4636,6 +4869,13 @@ namespace Cicm.Database.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Cicm.Database.Models.StorageByOwnedMachine",
b =>
{
b.HasOne("Cicm.Database.Models.OwnedMachine", "OwnedMachine").WithMany("Storage")
.HasForeignKey("OwnedMachineId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>",
b =>
{

View File

@@ -5,6 +5,8 @@ namespace Cicm.Database.Models
{
public class ApplicationUser : IdentityUser
{
public virtual ICollection<MachinePhoto> Photos { get; set; }
public virtual ICollection<MachinePhoto> Photos { get; set; }
public virtual ICollection<OwnedMachinePhoto> OwnedMachinePhotos { get; set; }
public virtual ICollection<OwnedMachine> OwnedMachines { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel;
namespace Cicm.Database.Models
{
public class GpusByOwnedMachine : BaseModel<long>
{
public int GpuId { get; set; }
public long OwnedMachineId { get; set; }
[DisplayName("GPU")]
public virtual Gpu Gpu { get; set; }
public virtual OwnedMachine OwnedMachine { get; set; }
}
}

View File

@@ -25,7 +25,8 @@ namespace Cicm.Database.Models
[Column(TypeName = "longtext")]
[StringLength(131072)]
[DataType(DataType.MultilineText)]
public string Text { get; set; }
public virtual ICollection<MachinePhoto> Photos { get; set; }
public string Text { get; set; }
public virtual ICollection<MachinePhoto> Photos { get; set; }
public virtual ICollection<OwnedMachinePhoto> OwnedMachinePhotos { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System.ComponentModel;
namespace Cicm.Database.Models
{
public class MemoryByOwnedMachine : BaseModel<long>
{
public long OwnedMachineId { get; set; }
public MemoryType Type { get; set; }
public MemoryUsage Usage { get; set; }
public long Size { get; set; }
[DisplayName("Speed (Hz)")]
public double Speed { get; set; }
public virtual OwnedMachine OwnedMachine { get; set; }
}
}

View File

@@ -1,53 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : OwnedComputer.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Describes a computer owned by a user.
//
// --[ 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
*******************************************************************************/
namespace Cicm.Database.Models
{
public class OwnedComputer : BaseModel<int>
{
public int DbId { get; set; }
public string Date { get; set; }
public StatusType Status { get; set; }
public int Trade { get; set; }
public int Boxed { get; set; }
public int Manuals { get; set; }
public int Cpu1 { get; set; }
public decimal Mhz1 { get; set; }
public int Cpu2 { get; set; }
public decimal Mhz2 { get; set; }
public int Ram { get; set; }
public int Vram { get; set; }
public string Rigid { get; set; }
public int Disk1 { get; set; }
public int Cap1 { get; set; }
public int Disk2 { get; set; }
public int Cap2 { get; set; }
}
}

View File

@@ -1,42 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : OwnedConsole.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Describes a console owned by a user.
//
// --[ 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
*******************************************************************************/
namespace Cicm.Database.Models
{
public class OwnedConsole : BaseModel<int>
{
public int DbId { get; set; }
public string Date { get; set; }
public StatusType Status { get; set; }
public int Trade { get; set; }
public int Boxed { get; set; }
public int Manuals { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
namespace Cicm.Database.Models
{
public class OwnedMachine : BaseModel<long>
{
public DateTime AcquisitionDate { get; set; }
public DateTime? LostDate { get; set; }
public StatusType Status { get; set; }
public DateTime? LastStatusDate { get; set; }
public bool Trade { get; set; }
public bool Boxed { get; set; }
public bool Manuals { get; set; }
public string SerialNumber { get; set; }
public bool SerialNumberVisible { get; set; }
public int MachineId { get; set; }
public virtual ICollection<GpusByOwnedMachine> Gpus { get; set; }
public virtual ICollection<MemoryByOwnedMachine> Memory { get; set; }
public virtual ICollection<ProcessorsByOwnedMachine> Processors { get; set; }
public virtual ICollection<SoundByOwnedMachine> Sound { get; set; }
public virtual ICollection<StorageByOwnedMachine> Storage { get; set; }
public virtual ICollection<OwnedMachinePhoto> Photos { get; set; }
public virtual ApplicationUser User { get; set; }
public virtual Machine Machine { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Models
{
public class OwnedMachinePhoto : BasePhoto
{
public virtual OwnedMachine OwnedMachine { get; set; }
public long OwnedMachineId { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel;
namespace Cicm.Database.Models
{
public class ProcessorsByOwnedMachine : BaseModel<long>
{
public int ProcessorId { get; set; }
public long OwnedMachineId { get; set; }
[DisplayName("Speed (MHz)")]
public float Speed { get; set; }
public virtual OwnedMachine OwnedMachine { get; set; }
public virtual Processor Processor { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel;
namespace Cicm.Database.Models
{
public class SoundByOwnedMachine : BaseModel<long>
{
public int SoundSynthId { get; set; }
public long OwnedMachineId { get; set; }
public virtual OwnedMachine OwnedMachine { get; set; }
[DisplayName("Sound synthetizer")]
public virtual SoundSynth SoundSynth { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models
{
public class StorageByOwnedMachine : BaseModel<long>
{
public long OwnedMachineId { get; set; }
public StorageType Type { get; set; }
public StorageInterface Interface { get; set; }
[Range(1, long.MaxValue)]
public long Capacity { get; set; }
public virtual OwnedMachine OwnedMachine { get; set; }
}
}

View File

@@ -58,8 +58,6 @@ namespace Cicm.Database.Models
public virtual DbSet<MemoryByMachine> MemoryByMachine { get; set; }
public virtual DbSet<MoneyDonation> MoneyDonations { get; set; }
public virtual DbSet<News> News { get; set; }
public virtual DbSet<OwnedComputer> OwnedComputers { get; set; }
public virtual DbSet<OwnedConsole> OwnedConsoles { get; set; }
public virtual DbSet<Processor> Processors { get; set; }
public virtual DbSet<ProcessorsByMachine> ProcessorsByMachine { get; set; }
public virtual DbSet<Resolution> Resolutions { get; set; }
@@ -68,6 +66,13 @@ namespace Cicm.Database.Models
public virtual DbSet<SoundSynth> SoundSynths { get; set; }
public virtual DbSet<StorageByMachine> StorageByMachine { get; set; }
public virtual DbSet<License> Licenses { get; set; }
public virtual DbSet<GpusByOwnedMachine> GpusByOwnedMachine { get; set; }
public virtual DbSet<MemoryByOwnedMachine> MemoryByOwnedMachine { get; set; }
public virtual DbSet<OwnedMachine> OwnedMachines { get; set; }
public virtual DbSet<OwnedMachinePhoto> OwnedMachinePhotos { get; set; }
public virtual DbSet<ProcessorsByOwnedMachine> ProcessorsByOwnedMachine { get; set; }
public virtual DbSet<SoundByOwnedMachine> SoundByOwnedMachine { get; set; }
public virtual DbSet<StorageByOwnedMachine> StorageByOwnedMachine { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -344,6 +349,15 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_gpus_by_machine_machine");
});
modelBuilder.Entity<GpusByOwnedMachine>(entity =>
{
entity.HasIndex(e => e.GpuId);
entity.HasIndex(e => e.OwnedMachineId);
entity.HasOne(d => d.OwnedMachine).WithMany(p => p.Gpus).HasForeignKey(d => d.OwnedMachineId);
});
modelBuilder.Entity<InstructionSetExtension>(entity =>
{
entity.ToTable("instruction_set_extensions");
@@ -481,6 +495,31 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_machines_family");
});
modelBuilder.Entity<OwnedMachine>(entity =>
{
entity.HasIndex(e => e.AcquisitionDate);
entity.HasIndex(e => e.LostDate);
entity.HasIndex(e => e.Status);
entity.HasIndex(e => e.LastStatusDate);
entity.HasIndex(e => e.Trade);
entity.HasIndex(e => e.Boxed);
entity.HasIndex(e => e.Manuals);
entity.HasIndex(e => e.SerialNumber);
entity.HasIndex(e => e.SerialNumberVisible);
entity.Property(e => e.SerialNumberVisible).HasDefaultValue(true);
entity.HasOne(d => d.User).WithMany(p => p.OwnedMachines).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<MachinePhoto>(entity =>
{
entity.HasIndex(e => e.Author);
@@ -554,6 +593,79 @@ namespace Cicm.Database.Models
entity.HasOne(d => d.License).WithMany(p => p.Photos).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<OwnedMachinePhoto>(entity =>
{
entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.CameraManufacturer);
entity.HasIndex(e => e.CameraModel);
entity.HasIndex(e => e.ColorSpace);
entity.HasIndex(e => e.Comments);
entity.HasIndex(e => e.Contrast);
entity.HasIndex(e => e.CreationDate);
entity.HasIndex(e => e.DigitalZoomRatio);
entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.Exposure);
entity.HasIndex(e => e.ExposureMethod);
entity.HasIndex(e => e.ExposureProgram);
entity.HasIndex(e => e.Flash);
entity.HasIndex(e => e.Focal);
entity.HasIndex(e => e.FocalLength);
entity.HasIndex(e => e.FocalLengthEquivalent);
entity.HasIndex(e => e.HorizontalResolution);
entity.HasIndex(e => e.IsoRating);
entity.HasIndex(e => e.Lens);
entity.HasIndex(e => e.LightSource);
entity.HasIndex(e => e.MeteringMode);
entity.HasIndex(e => e.ResolutionUnit);
entity.HasIndex(e => e.Orientation);
entity.HasIndex(e => e.Saturation);
entity.HasIndex(e => e.SceneCaptureType);
entity.HasIndex(e => e.SensingMethod);
entity.HasIndex(e => e.Sharpness);
entity.HasIndex(e => e.SoftwareUsed);
entity.HasIndex(e => e.SubjectDistanceRange);
entity.HasIndex(e => e.UploadDate);
entity.HasIndex(e => e.VerticalResolution);
entity.HasIndex(e => e.WhiteBalance);
entity.HasOne(d => d.OwnedMachine).WithMany(p => p.Photos).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User).WithMany(p => p.OwnedMachinePhotos).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.License).WithMany(p => p.OwnedMachinePhotos).OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<MemoryByMachine>(entity =>
{
entity.ToTable("memory_by_machine");
@@ -584,6 +696,21 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_memory_by_machine_machine");
});
modelBuilder.Entity<MemoryByOwnedMachine>(entity =>
{
entity.HasIndex(e => e.OwnedMachineId);
entity.HasIndex(e => e.Size);
entity.HasIndex(e => e.Speed);
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.Usage);
entity.HasOne(d => d.OwnedMachine).WithMany(p => p.Memory).HasForeignKey(d => d.OwnedMachineId);
});
modelBuilder.Entity<MoneyDonation>(entity =>
{
entity.ToTable("money_donations");
@@ -621,121 +748,6 @@ namespace Cicm.Database.Models
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
});
modelBuilder.Entity<OwnedComputer>(entity =>
{
entity.ToTable("owned_computers");
entity.HasIndex(e => e.Boxed).HasName("idx_owned_computers_boxed");
entity.HasIndex(e => e.Cap1).HasName("idx_owned_computers_cap1");
entity.HasIndex(e => e.Cap2).HasName("idx_owned_computers_cap2");
entity.HasIndex(e => e.Cpu1).HasName("idx_owned_computers_cpu1");
entity.HasIndex(e => e.Cpu2).HasName("idx_owned_computers_cpu2");
entity.HasIndex(e => e.Date).HasName("idx_owned_computers_date");
entity.HasIndex(e => e.DbId).HasName("idx_owned_computers_db_id");
entity.HasIndex(e => e.Disk1).HasName("idx_owned_computers_disk1");
entity.HasIndex(e => e.Disk2).HasName("idx_owned_computers_disk2");
entity.HasIndex(e => e.Manuals).HasName("idx_owned_computers_manuals");
entity.HasIndex(e => e.Mhz1).HasName("idx_owned_computers_mhz1");
entity.HasIndex(e => e.Mhz2).HasName("idx_owned_computers_mhz2");
entity.HasIndex(e => e.Ram).HasName("idx_owned_computers_ram");
entity.HasIndex(e => e.Rigid).HasName("idx_owned_computers_rigid");
entity.HasIndex(e => e.Status).HasName("idx_owned_computers_status");
entity.HasIndex(e => e.Trade).HasName("idx_owned_computers_trade");
entity.HasIndex(e => e.Vram).HasName("idx_owned_computers_vram");
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
entity.Property(e => e.Boxed).HasColumnName("boxed").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Cap1).HasColumnName("cap1").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Cap2).HasColumnName("cap2").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Cpu1).HasColumnName("cpu1").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Cpu2).HasColumnName("cpu2").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("varchar(20)")
.HasDefaultValueSql("''");
entity.Property(e => e.DbId).HasColumnName("db_id").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Disk1).HasColumnName("disk1").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Disk2).HasColumnName("disk2").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Manuals).HasColumnName("manuals").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Mhz1).HasColumnName("mhz1").HasColumnType("decimal(10,0)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Mhz2).HasColumnName("mhz2").HasColumnType("decimal(10,0)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Ram).HasColumnName("ram").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Rigid).IsRequired().HasColumnName("rigid").HasColumnType("varchar(64)")
.HasDefaultValueSql("''");
entity.Property(e => e.Status).HasColumnName("status").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Trade).HasColumnName("trade").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Vram).HasColumnName("vram").HasColumnType("int(11)").HasDefaultValueSql("'0'");
});
modelBuilder.Entity<OwnedConsole>(entity =>
{
entity.ToTable("owned_consoles");
entity.HasIndex(e => e.Boxed).HasName("idx_owned_consoles_boxed");
entity.HasIndex(e => e.Date).HasName("idx_owned_consoles_date");
entity.HasIndex(e => e.DbId).HasName("idx_owned_consoles_db_id");
entity.HasIndex(e => e.Manuals).HasName("idx_owned_consoles_manuals");
entity.HasIndex(e => e.Status).HasName("idx_owned_consoles_status");
entity.HasIndex(e => e.Trade).HasName("idx_owned_consoles_trade");
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
entity.Property(e => e.Boxed).HasColumnName("boxed").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("char(20)")
.HasDefaultValueSql("''");
entity.Property(e => e.DbId).HasColumnName("db_id").HasColumnType("int(11)").HasDefaultValueSql("'0'");
entity.Property(e => e.Manuals).HasColumnName("manuals").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Status).HasColumnName("status").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Trade).HasColumnName("trade").HasColumnType("int(11)").HasDefaultValueSql("'0'");
});
modelBuilder.Entity<Processor>(entity =>
{
entity.ToTable("processors");
@@ -871,6 +883,17 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_processors_by_machine_processor");
});
modelBuilder.Entity<ProcessorsByOwnedMachine>(entity =>
{
entity.HasIndex(e => e.OwnedMachineId);
entity.HasIndex(e => e.ProcessorId);
entity.HasIndex(e => e.Speed);
entity.HasOne(d => d.OwnedMachine).WithMany(p => p.Processors).HasForeignKey(d => d.OwnedMachineId);
});
modelBuilder.Entity<Resolution>(entity =>
{
entity.ToTable("resolutions");
@@ -948,6 +971,15 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_sound_by_machine_sound_synth");
});
modelBuilder.Entity<SoundByOwnedMachine>(entity =>
{
entity.HasIndex(e => e.OwnedMachineId);
entity.HasIndex(e => e.SoundSynthId);
entity.HasOne(d => d.OwnedMachine).WithMany(p => p.Sound).HasForeignKey(d => d.OwnedMachineId);
});
modelBuilder.Entity<SoundSynth>(entity =>
{
entity.ToTable("sound_synths");
@@ -1026,6 +1058,19 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_storage_by_machine_machine");
});
modelBuilder.Entity<StorageByOwnedMachine>(entity =>
{
entity.HasIndex(e => e.Capacity);
entity.HasIndex(e => e.Interface);
entity.HasIndex(e => e.OwnedMachineId);
entity.HasIndex(e => e.Type);
entity.HasOne(d => d.OwnedMachine).WithMany(p => p.Storage).HasForeignKey(d => d.OwnedMachineId);
});
modelBuilder.Entity<License>(entity =>
{
entity.HasIndex(e => e.Name);

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.653</Version>
<Version>3.0.99.674</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>