using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace line_gestao_api.Migrations { /// public partial class AddAuditLogs : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AuditLogs", columns: table => new { Id = table.Column(type: "uuid", nullable: false), TenantId = table.Column(type: "uuid", nullable: false), OccurredAtUtc = table.Column(type: "timestamp with time zone", nullable: false), UserId = table.Column(type: "uuid", nullable: true), UserName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), UserEmail = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), Action = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), Page = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), EntityName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), EntityId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), EntityLabel = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), ChangesJson = table.Column(type: "jsonb", nullable: false), RequestPath = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), RequestMethod = table.Column(type: "character varying(10)", maxLength: 10, nullable: true), IpAddress = table.Column(type: "character varying(80)", maxLength: 80, nullable: true) }, constraints: table => { table.PrimaryKey("PK_AuditLogs", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_AuditLogs_EntityName", table: "AuditLogs", column: "EntityName"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_OccurredAtUtc", table: "AuditLogs", column: "OccurredAtUtc"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_Page", table: "AuditLogs", column: "Page"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_TenantId", table: "AuditLogs", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_AuditLogs_UserId", table: "AuditLogs", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AuditLogs"); } } }