using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DiunaBI.Infrastructure.Migrations { /// public partial class RecordHistory : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "RecordHistory", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), RecordId = table.Column(type: "uniqueidentifier", nullable: false), LayerId = table.Column(type: "uniqueidentifier", nullable: false), ChangedAt = table.Column(type: "datetime2", nullable: false), ChangedById = table.Column(type: "uniqueidentifier", nullable: false), ChangeType = table.Column(type: "int", nullable: false), Code = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Desc1 = table.Column(type: "nvarchar(max)", maxLength: 10000, nullable: true), ChangedFields = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), ChangesSummary = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_RecordHistory", x => x.Id); table.ForeignKey( name: "FK_RecordHistory_Users_ChangedById", column: x => x.ChangedById, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_RecordHistory_ChangedById", table: "RecordHistory", column: "ChangedById"); migrationBuilder.CreateIndex( name: "IX_RecordHistory_LayerId_ChangedAt", table: "RecordHistory", columns: new[] { "LayerId", "ChangedAt" }); migrationBuilder.CreateIndex( name: "IX_RecordHistory_RecordId_ChangedAt", table: "RecordHistory", columns: new[] { "RecordId", "ChangedAt" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "RecordHistory"); } } }