using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TrueCV.Infrastructure.Data.Migrations
{
///
public partial class AddAuditLogTable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AuditLogs",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
UserId = table.Column(type: "uniqueidentifier", nullable: false),
Action = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityType = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true),
EntityId = table.Column(type: "uniqueidentifier", nullable: true),
Details = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
IpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AuditLogs", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_AuditLogs_Action",
table: "AuditLogs",
column: "Action");
migrationBuilder.CreateIndex(
name: "IX_AuditLogs_CreatedAt",
table: "AuditLogs",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_AuditLogs_UserId",
table: "AuditLogs",
column: "UserId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AuditLogs");
}
}
}