mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Allow setting several density codes with the same code.
This commit is contained in:
1571
DiscImageChef.Database/Migrations/20190525183723_IdForDensityCode.Designer.cs
generated
Normal file
1571
DiscImageChef.Database/Migrations/20190525183723_IdForDensityCode.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace DiscImageChef.Database.Migrations
|
||||
{
|
||||
public partial class IdForDensityCode : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameTable("DensityCode", newName: "DensityCode_old");
|
||||
|
||||
migrationBuilder.CreateTable("DensityCode",
|
||||
table => new
|
||||
{
|
||||
Code = table.Column<int>(nullable: false, defaultValue: 0),
|
||||
SscSupportedMediaId = table.Column<int>(nullable: true),
|
||||
Id = table.Column<int>()
|
||||
.Annotation("Sqlite:Autoincrement", true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DensityCode", x => x.Id);
|
||||
table.ForeignKey("FK_DensityCode_SscSupportedMedia_SscSupportedMediaId",
|
||||
x => x.SscSupportedMediaId, "SscSupportedMedia", "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder
|
||||
.Sql("INSERT INTO DensityCode (Code, SscSupportedMediaId) SELECT Code, SscSupportedMediaId FROM DensityCode_old");
|
||||
|
||||
migrationBuilder.DropTable("DensityCode_old");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameTable("DensityCode", newName: "DensityCode_old");
|
||||
|
||||
migrationBuilder.CreateTable("DensityCode",
|
||||
table => new
|
||||
{
|
||||
Code = table.Column<int>()
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SscSupportedMediaId = table.Column<int>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DensityCode", x => x.Code);
|
||||
table.ForeignKey("FK_DensityCode_SscSupportedMedia_SscSupportedMediaId",
|
||||
x => x.SscSupportedMediaId, "SscSupportedMedia", "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder
|
||||
.Sql("INSERT INTO DensityCode (Code, SscSupportedMediaId) SELECT Code, SscSupportedMediaId FROM DensityCode_old");
|
||||
|
||||
migrationBuilder.DropTable("DensityCode_old");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace DiscImageChef.Database.Migrations
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ata", b =>
|
||||
{
|
||||
@@ -75,11 +75,13 @@ namespace DiscImageChef.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.DensityCode", b =>
|
||||
{
|
||||
b.Property<int>("Code").ValueGeneratedOnAdd();
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Code");
|
||||
|
||||
b.Property<int?>("SscSupportedMediaId");
|
||||
|
||||
b.HasKey("Code");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SscSupportedMediaId");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user