mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix USB IDs and indexes in databases.
This commit is contained in:
15
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
15
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -137,6 +137,7 @@
|
||||
<e p="MediaType.cs" t="Include" />
|
||||
<e p="MediaTypeFromSCSI.cs" t="Include" />
|
||||
<e p="Metadata" t="Include">
|
||||
<e p="CdOffset.cs" t="Include" />
|
||||
<e p="DeviceReport.cs" t="Include" />
|
||||
<e p="DeviceReportV2.cs" t="Include" />
|
||||
<e p="Dimensions.cs" t="Include" />
|
||||
@@ -319,6 +320,10 @@
|
||||
<e p="20181223183913_FixUnsignedFields.cs" t="Include" />
|
||||
<e p="20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.Designer.cs" t="Include" />
|
||||
<e p="20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.cs" t="Include" />
|
||||
<e p="20181224044809_StoreUsbIdsInDatabase.Designer.cs" t="Include" />
|
||||
<e p="20181224044809_StoreUsbIdsInDatabase.cs" t="Include" />
|
||||
<e p="20181224172147_FixUsbIdsAndIndexes.Designer.cs" t="Include" />
|
||||
<e p="20181224172147_FixUsbIdsAndIndexes.cs" t="Include" />
|
||||
<e p="DicContextModelSnapshot.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Models" t="Include">
|
||||
@@ -332,6 +337,8 @@
|
||||
<e p="OperatingSystem.cs" t="Include" />
|
||||
<e p="Partition.cs" t="Include" />
|
||||
<e p="Report.cs" t="Include" />
|
||||
<e p="UsbProduct.cs" t="Include" />
|
||||
<e p="UsbVendor.cs" t="Include" />
|
||||
<e p="Version.cs" t="Include" />
|
||||
</e>
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
@@ -1808,6 +1815,12 @@
|
||||
<e p="201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.Designer.cs" t="Include" />
|
||||
<e p="201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.cs" t="Include" />
|
||||
<e p="201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.resx" t="Include" />
|
||||
<e p="201812240552109_StoreUsbIdsInDatabase.Designer.cs" t="Include" />
|
||||
<e p="201812240552109_StoreUsbIdsInDatabase.cs" t="Include" />
|
||||
<e p="201812240552109_StoreUsbIdsInDatabase.resx" t="Include" />
|
||||
<e p="201812241719441_FixUsbIdsAndIndexes.Designer.cs" t="Include" />
|
||||
<e p="201812241719441_FixUsbIdsAndIndexes.cs" t="Include" />
|
||||
<e p="201812241719441_FixUsbIdsAndIndexes.resx" t="Include" />
|
||||
<e p="Configuration.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Models" t="Include">
|
||||
@@ -1822,6 +1835,8 @@
|
||||
<e p="OperatingSystem.cs" t="Include" />
|
||||
<e p="Partition.cs" t="Include" />
|
||||
<e p="UploadedReport.cs" t="Include" />
|
||||
<e p="UsbProduct.cs" t="Include" />
|
||||
<e p="UsbVendor.cs" t="Include" />
|
||||
<e p="Version.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Reports" t="Include">
|
||||
|
||||
@@ -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" />
|
||||
|
||||
1407
DiscImageChef.Database/Migrations/20181224172147_FixUsbIdsAndIndexes.Designer.cs
generated
Normal file
1407
DiscImageChef.Database/Migrations/20181224172147_FixUsbIdsAndIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscImageChef.Database.Models
|
||||
{
|
||||
@@ -16,12 +17,13 @@ namespace DiscImageChef.Database.Models
|
||||
|
||||
[Key]
|
||||
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; }
|
||||
|
||||
[Index]
|
||||
public ushort VendorId { get; set; }
|
||||
public virtual UsbVendor Vendor { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscImageChef.Database.Models
|
||||
{
|
||||
@@ -19,6 +20,7 @@ namespace DiscImageChef.Database.Models
|
||||
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; }
|
||||
|
||||
@@ -221,6 +221,10 @@
|
||||
<Compile Include="Migrations\201812240552109_StoreUsbIdsInDatabase.Designer.cs">
|
||||
<DependentUpon>201812240552109_StoreUsbIdsInDatabase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201812241719441_FixUsbIdsAndIndexes.cs" />
|
||||
<Compile Include="Migrations\201812241719441_FixUsbIdsAndIndexes.Designer.cs">
|
||||
<DependentUpon>201812241719441_FixUsbIdsAndIndexes.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Models\Command.cs" />
|
||||
<Compile Include="Models\Context.cs" />
|
||||
@@ -325,6 +329,9 @@
|
||||
<EmbeddedResource Include="Migrations\201812240552109_StoreUsbIdsInDatabase.resx">
|
||||
<DependentUpon>201812240552109_StoreUsbIdsInDatabase.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201812241719441_FixUsbIdsAndIndexes.resx">
|
||||
<DependentUpon>201812241719441_FixUsbIdsAndIndexes.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
|
||||
29
DiscImageChef.Server/Migrations/201812241719441_FixUsbIdsAndIndexes.Designer.cs
generated
Normal file
29
DiscImageChef.Server/Migrations/201812241719441_FixUsbIdsAndIndexes.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace DiscImageChef.Server.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
|
||||
public sealed partial class FixUsbIdsAndIndexes : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(FixUsbIdsAndIndexes));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201812241719441_FixUsbIdsAndIndexes"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
namespace DiscImageChef.Server.Migrations
|
||||
{
|
||||
public partial class FixUsbIdsAndIndexes : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.UsbVendors", "VendorId", c => c.Int(false));
|
||||
CreateIndex("dbo.UsbProducts", "ProductId");
|
||||
CreateIndex("dbo.UsbProducts", "ModifiedWhen");
|
||||
CreateIndex("dbo.UsbVendors", "VendorId", true);
|
||||
CreateIndex("dbo.UsbVendors", "ModifiedWhen");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.UsbVendors", new[] {"ModifiedWhen"});
|
||||
DropIndex("dbo.UsbVendors", new[] {"VendorId"});
|
||||
DropIndex("dbo.UsbProducts", new[] {"ModifiedWhen"});
|
||||
DropIndex("dbo.UsbProducts", new[] {"ProductId"});
|
||||
DropColumn("dbo.UsbVendors", "VendorId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscImageChef.Server.Models
|
||||
{
|
||||
@@ -7,21 +8,23 @@ namespace DiscImageChef.Server.Models
|
||||
{
|
||||
public UsbProduct() { }
|
||||
|
||||
public UsbProduct(ushort vendorId, ushort id, string product)
|
||||
public UsbProduct(UsbVendor vendor, ushort id, string product)
|
||||
{
|
||||
ProductId = id;
|
||||
Product = product;
|
||||
AddedWhen = ModifiedWhen = DateTime.UtcNow;
|
||||
Vendor = vendor;
|
||||
}
|
||||
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[Index]
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public string Product { get; set; }
|
||||
public DateTime AddedWhen { get; set; }
|
||||
[Index]
|
||||
public DateTime ModifiedWhen { get; set; }
|
||||
|
||||
[Index]
|
||||
public int VendorId { get; set; }
|
||||
public virtual UsbVendor Vendor { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscImageChef.Server.Models
|
||||
{
|
||||
@@ -10,15 +11,18 @@ namespace DiscImageChef.Server.Models
|
||||
|
||||
public UsbVendor(ushort id, string vendor)
|
||||
{
|
||||
Id = id;
|
||||
VendorId = id;
|
||||
Vendor = vendor;
|
||||
AddedWhen = ModifiedWhen = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[Index(IsUnique = true)]
|
||||
public int VendorId { 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; }
|
||||
|
||||
Reference in New Issue
Block a user