2019-05-26 00:44:26 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
|
namespace Aaru.Database.Migrations
|
2019-05-26 00:44:26 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class IdForDensityCode : Migration
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
migrationBuilder.RenameTable("DensityCode", newName: "DensityCode_old");
|
|
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
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");
|
2019-05-26 00:44:26 +01:00
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable("DensityCode_old");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
migrationBuilder.RenameTable("DensityCode", newName: "DensityCode_old");
|
|
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
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");
|
2019-05-26 00:44:26 +01:00
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable("DensityCode_old");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|