using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class WidenPhiEncryptedColumns : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "last_name", table: "patients", type: "text", maxLength: 100, nullable: false, oldClrType: typeof(string), oldType: "character varying(100)", oldMaxLength: 100); migrationBuilder.AlterColumn( name: "first_name", table: "patients", type: "text", maxLength: 100, nullable: false, oldClrType: typeof(string), oldType: "character varying(100)", oldMaxLength: 100); migrationBuilder.AlterColumn( name: "emergency_contact_phone", table: "patients", type: "text", maxLength: 20, nullable: true, oldClrType: typeof(string), oldType: "character varying(20)", oldMaxLength: 20, oldNullable: true); migrationBuilder.AlterColumn( name: "emergency_contact_name", table: "patients", type: "text", maxLength: 200, nullable: true, oldClrType: typeof(string), oldType: "character varying(200)", oldMaxLength: 200, oldNullable: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.Sql( """ UPDATE patients SET last_name = LEFT(last_name, 100); UPDATE patients SET first_name = LEFT(first_name, 100); UPDATE patients SET emergency_contact_phone = LEFT(emergency_contact_phone, 20); UPDATE patients SET emergency_contact_name = LEFT(emergency_contact_name, 200); """); migrationBuilder.AlterColumn( name: "last_name", table: "patients", type: "character varying(100)", maxLength: 100, nullable: false, oldClrType: typeof(string), oldType: "text", oldMaxLength: 100); migrationBuilder.AlterColumn( name: "first_name", table: "patients", type: "character varying(100)", maxLength: 100, nullable: false, oldClrType: typeof(string), oldType: "text", oldMaxLength: 100); migrationBuilder.AlterColumn( name: "emergency_contact_phone", table: "patients", type: "character varying(20)", maxLength: 20, nullable: true, oldClrType: typeof(string), oldType: "text", oldMaxLength: 20, oldNullable: true); migrationBuilder.AlterColumn( name: "emergency_contact_name", table: "patients", type: "character varying(200)", maxLength: 200, nullable: true, oldClrType: typeof(string), oldType: "text", oldMaxLength: 200, oldNullable: true); } } }