47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
namespace Hcs.WebApp.Data.Hcs.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddMeteringDeviceEntity : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "MeteringDevices",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
HcsId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
ThirdPartyId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
SyncedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastSyncOperationId = table.Column<int>(type: "int", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_MeteringDevices", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_MeteringDevices_Operations_LastSyncOperationId",
|
|
column: x => x.LastSyncOperationId,
|
|
principalTable: "Operations",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MeteringDevices_LastSyncOperationId",
|
|
table: "MeteringDevices",
|
|
column: "LastSyncOperationId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "MeteringDevices");
|
|
}
|
|
}
|
|
}
|