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:
@@ -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,22 +8,24 @@ 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; }
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public string Product { get; set; }
|
||||
public DateTime AddedWhen { get; set; }
|
||||
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; }
|
||||
|
||||
public int VendorId { get; set; }
|
||||
public virtual UsbVendor Vendor { 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; }
|
||||
public string Vendor { get; set; }
|
||||
public DateTime AddedWhen { get; set; }
|
||||
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