56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
|
|
using System;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|
|||
|
|
#nullable disable
|
|||
|
|
|
|||
|
|
namespace TrueCV.Infrastructure.Data.Migrations
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
public partial class AddAuditLogTable : Migration
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "AuditLogs",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|||
|
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|||
|
|
Action = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|||
|
|
EntityType = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
|||
|
|
EntityId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|||
|
|
Details = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
|
|||
|
|
IpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
|||
|
|
CreatedAt = table.Column<DateTime>(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");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "AuditLogs");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|