81 lines
2.9 KiB
C#
81 lines
2.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ManagerService.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UpdateMapAnnotation : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_MapAnnotation_ResourceDTO_IconResourceDTOid",
|
|
table: "MapAnnotation");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ResourceDTO");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "IconResourceDTOid",
|
|
table: "MapAnnotation",
|
|
newName: "IconResourceId");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_MapAnnotation_IconResourceDTOid",
|
|
table: "MapAnnotation",
|
|
newName: "IX_MapAnnotation_IconResourceId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_MapAnnotation_Resources_IconResourceId",
|
|
table: "MapAnnotation",
|
|
column: "IconResourceId",
|
|
principalTable: "Resources",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_MapAnnotation_Resources_IconResourceId",
|
|
table: "MapAnnotation");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "IconResourceId",
|
|
table: "MapAnnotation",
|
|
newName: "IconResourceDTOid");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_MapAnnotation_IconResourceId",
|
|
table: "MapAnnotation",
|
|
newName: "IX_MapAnnotation_IconResourceDTOid");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ResourceDTO",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<string>(type: "text", nullable: false),
|
|
dateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
instanceId = table.Column<string>(type: "text", nullable: true),
|
|
label = table.Column<string>(type: "text", nullable: true),
|
|
type = table.Column<int>(type: "integer", nullable: false),
|
|
url = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ResourceDTO", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_MapAnnotation_ResourceDTO_IconResourceDTOid",
|
|
table: "MapAnnotation",
|
|
column: "IconResourceDTOid",
|
|
principalTable: "ResourceDTO",
|
|
principalColumn: "id");
|
|
}
|
|
}
|
|
}
|