using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace VigilCareClinicalAPI.Migrations
{
///
public partial class AddPhiAccessLogs : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "phi_access_logs",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
access_type = table.Column(type: "character varying(20)", maxLength: 20, nullable: false),
patient_id = table.Column(type: "uuid", nullable: true),
user_id = table.Column(type: "uuid", nullable: false),
user_display_name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false),
resource_path = table.Column(type: "character varying(500)", maxLength: 500, nullable: false),
search_query_hash = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
result_count = table.Column(type: "integer", nullable: true),
ip_address = table.Column(type: "character varying(45)", maxLength: 45, nullable: true),
correlation_id = table.Column(type: "character varying(100)", maxLength: 100, nullable: true),
accessed_at = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "NOW()")
},
constraints: table =>
{
table.PrimaryKey("PK_phi_access_logs", x => x.id);
});
migrationBuilder.CreateIndex(
name: "IX_phi_access_logs_accessed_at",
table: "phi_access_logs",
column: "accessed_at");
migrationBuilder.CreateIndex(
name: "IX_phi_access_logs_patient_id",
table: "phi_access_logs",
column: "patient_id");
migrationBuilder.CreateIndex(
name: "IX_phi_access_logs_user_id",
table: "phi_access_logs",
column: "user_id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "phi_access_logs");
}
}
}