Initial commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PowderCoating.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddAuditLogTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuditLogs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
UserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CompanyId = table.Column<int>(type: "int", nullable: true),
|
||||
CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Action = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
EntityType = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||
EntityId = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
||||
EntityDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
OldValues = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
NewValues = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IpAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Timestamp = table.Column<DateTime>(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" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuditLogs");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user