using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class AddClinicalAuditLogs : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "clinical_audit_logs", columns: table => new { id = table.Column(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"), action = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), entity_type = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), entity_id = table.Column(type: "uuid", nullable: false), user_id = table.Column(type: "uuid", nullable: true), user_display_name = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), previous_value_json = table.Column(type: "jsonb", nullable: true), new_value_json = table.Column(type: "jsonb", nullable: true), reason = table.Column(type: "text", 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), created_at = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "NOW()") }, constraints: table => { table.PrimaryKey("PK_clinical_audit_logs", x => x.id); }); migrationBuilder.CreateIndex( name: "IX_clinical_audit_logs_created_at", table: "clinical_audit_logs", column: "created_at"); migrationBuilder.CreateIndex( name: "IX_clinical_audit_logs_entity_id", table: "clinical_audit_logs", column: "entity_id"); migrationBuilder.CreateIndex( name: "IX_clinical_audit_logs_entity_type", table: "clinical_audit_logs", column: "entity_type"); migrationBuilder.CreateIndex( name: "IX_clinical_audit_logs_user_id", table: "clinical_audit_logs", column: "user_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "clinical_audit_logs"); } } }