using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Nuuru.Server.Migrations { /// public partial class AddAuditLog : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AuditLogs", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Action = table.Column(type: "TEXT", nullable: false), Category = table.Column(type: "TEXT", nullable: false), TargetType = table.Column(type: "TEXT", nullable: true), TargetId = table.Column(type: "TEXT", nullable: true), Details = table.Column(type: "TEXT", nullable: true), IpAddress = table.Column(type: "TEXT", nullable: true), HttpMethod = table.Column(type: "TEXT", nullable: false), RequestPath = table.Column(type: "TEXT", nullable: false), ResponseStatusCode = table.Column(type: "INTEGER", nullable: false), Timestamp = table.Column(type: "TEXT", nullable: false), UserId = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AuditLogs", x => x.Id); table.ForeignKey( name: "FK_AuditLogs_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateIndex( name: "IX_AuditLogs_Action", table: "AuditLogs", column: "Action"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_Category", table: "AuditLogs", column: "Category"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_IpAddress", table: "AuditLogs", column: "IpAddress"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_Timestamp", table: "AuditLogs", column: "Timestamp", descending: new bool[0]); migrationBuilder.CreateIndex( name: "IX_AuditLogs_UserId", table: "AuditLogs", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AuditLogs"); } } }