Fix USB IDs and indexes in databases.

This commit is contained in:
2018-12-24 21:13:02 +00:00
parent 383794bace
commit 5a0714e795
13 changed files with 1673 additions and 24 deletions

View File

@@ -82,6 +82,8 @@
<Compile Include="Migrations\20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.Designer.cs" />
<Compile Include="Migrations\20181224044809_StoreUsbIdsInDatabase.cs" />
<Compile Include="Migrations\20181224044809_StoreUsbIdsInDatabase.Designer.cs" />
<Compile Include="Migrations\20181224172147_FixUsbIdsAndIndexes.cs" />
<Compile Include="Migrations\20181224172147_FixUsbIdsAndIndexes.Designer.cs" />
<Compile Include="Migrations\DicContextModelSnapshot.cs" />
<Compile Include="Models\Command.cs" />
<Compile Include="Models\Device.cs" />

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace DiscImageChef.Database.Migrations
{
public partial class FixUsbIdsAndIndexes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex("IX_UsbProducts_ProductId", "UsbProducts", "ProductId");
migrationBuilder.CreateIndex("IX_UsbProducts_ModifiedWhen", "UsbProducts", "ModifiedWhen");
migrationBuilder.CreateIndex("IX_UsbVendors_ModifiedWhen", "UsbVendors", "ModifiedWhen");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex("IX_UsbProducts_ProductId", "UsbProducts");
migrationBuilder.DropIndex("IX_UsbProducts_ModifiedWhen", "UsbProducts");
migrationBuilder.DropIndex("IX_UsbVendors_ModifiedWhen", "UsbVendors");
}
}
}

View File

@@ -1140,6 +1140,10 @@ namespace DiscImageChef.Database.Migrations
b.HasIndex("VendorId");
b.HasIndex("ProductId");
b.HasIndex("ModifiedWhen");
b.ToTable("UsbProducts");
});
@@ -1155,6 +1159,8 @@ namespace DiscImageChef.Database.Migrations
b.HasKey("Id");
b.HasIndex("ModifiedWhen");
b.ToTable("UsbVendors");
});

View File

@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DiscImageChef.Database.Models
{
@@ -15,14 +16,15 @@ namespace DiscImageChef.Database.Models
}
[Key]
public int Id { get; set; }
public ushort ProductId { get; set; }
public string Product { get; set; }
public DateTime AddedWhen { get; set; }
public int Id { get; set; }
[Index]
public ushort ProductId { get; set; }
public string Product { get; set; }
public DateTime AddedWhen { get; set; }
[Index]
public DateTime ModifiedWhen { get; set; }
public ushort VendorId { get; set; }
public virtual UsbVendor Vendor { get; set; }
[Index]
public ushort VendorId { get; set; }
public virtual UsbVendor Vendor { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DiscImageChef.Database.Models
{
@@ -16,9 +17,10 @@ namespace DiscImageChef.Database.Models
}
[Key]
public ushort Id { get; set; }
public string Vendor { get; set; }
public DateTime AddedWhen { get; set; }
public ushort Id { get; set; }
public string Vendor { get; set; }
public DateTime AddedWhen { get; set; }
[Index]
public DateTime ModifiedWhen { get; set; }
public virtual ICollection<UsbProduct> Products { get; set; }