using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace HyperBooru.Migrations { /// public partial class NullableCurrentUploadedFile : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Media_UploadedFiles_CurrentUploadedFileId", table: "Media"); migrationBuilder.DropColumn( name: "DisplayName", table: "SecurityPrincipals"); migrationBuilder.AlterColumn( name: "Owner", table: "Objects", type: "bytea", nullable: false, defaultValue: new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, oldClrType: typeof(byte[]), oldType: "bytea", oldDefaultValue: new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }); migrationBuilder.AlterColumn( name: "CurrentUploadedFileId", table: "Media", type: "integer", nullable: true, oldClrType: typeof(int), oldType: "integer"); migrationBuilder.AddForeignKey( name: "FK_Media_UploadedFiles_CurrentUploadedFileId", table: "Media", column: "CurrentUploadedFileId", principalTable: "UploadedFiles", principalColumn: "ObjectId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Media_UploadedFiles_CurrentUploadedFileId", table: "Media"); migrationBuilder.AddColumn( name: "DisplayName", table: "SecurityPrincipals", type: "text", nullable: false, defaultValue: ""); migrationBuilder.AlterColumn( name: "Owner", table: "Objects", type: "bytea", nullable: false, defaultValue: new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, oldClrType: typeof(byte[]), oldType: "bytea", oldDefaultValue: new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }); migrationBuilder.AlterColumn( name: "CurrentUploadedFileId", table: "Media", type: "integer", nullable: false, defaultValue: 0, oldClrType: typeof(int), oldType: "integer", oldNullable: true); migrationBuilder.UpdateData( table: "SecurityPrincipals", keyColumn: "LocalPrincipalId", keyValue: -1, column: "DisplayName", value: "Administrator"); migrationBuilder.AddForeignKey( name: "FK_Media_UploadedFiles_CurrentUploadedFileId", table: "Media", column: "CurrentUploadedFileId", principalTable: "UploadedFiles", principalColumn: "ObjectId", onDelete: ReferentialAction.Cascade); } } }