using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddAuditLogTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AuditLogs", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "nvarchar(max)", nullable: true), UserName = table.Column(type: "nvarchar(max)", nullable: false), CompanyId = table.Column(type: "int", nullable: true), CompanyName = table.Column(type: "nvarchar(max)", nullable: true), Action = table.Column(type: "nvarchar(max)", nullable: false), EntityType = table.Column(type: "nvarchar(450)", nullable: false), EntityId = table.Column(type: "nvarchar(450)", nullable: true), EntityDescription = table.Column(type: "nvarchar(max)", nullable: true), OldValues = table.Column(type: "nvarchar(max)", nullable: true), NewValues = table.Column(type: "nvarchar(max)", nullable: true), IpAddress = table.Column(type: "nvarchar(max)", nullable: true), Timestamp = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AuditLogs", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_AuditLogs_CompanyId_Timestamp", table: "AuditLogs", columns: new[] { "CompanyId", "Timestamp" }); migrationBuilder.CreateIndex( name: "IX_AuditLogs_EntityType_EntityId", table: "AuditLogs", columns: new[] { "EntityType", "EntityId" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AuditLogs"); } } }