using Microsoft.EntityFrameworkCore.Migrations; namespace StudyLib.Migrations { public partial class AddedGroupToSubject : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Subjects_Groups_GroupID", table: "Subjects"); migrationBuilder.RenameColumn( name: "GroupID", table: "Subjects", newName: "GroupId"); migrationBuilder.RenameIndex( name: "IX_Subjects_GroupID", table: "Subjects", newName: "IX_Subjects_GroupId"); migrationBuilder.AlterColumn( name: "GroupId", table: "Subjects", type: "bigint", nullable: false, defaultValue: 0L, oldClrType: typeof(long), oldType: "bigint", oldNullable: true); migrationBuilder.AddForeignKey( name: "FK_Subjects_Groups_GroupId", table: "Subjects", column: "GroupId", principalTable: "Groups", principalColumn: "ID", onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Subjects_Groups_GroupId", table: "Subjects"); migrationBuilder.RenameColumn( name: "GroupId", table: "Subjects", newName: "GroupID"); migrationBuilder.RenameIndex( name: "IX_Subjects_GroupId", table: "Subjects", newName: "IX_Subjects_GroupID"); migrationBuilder.AlterColumn( name: "GroupID", table: "Subjects", type: "bigint", nullable: true, oldClrType: typeof(long), oldType: "bigint"); migrationBuilder.AddForeignKey( name: "FK_Subjects_Groups_GroupID", table: "Subjects", column: "GroupID", principalTable: "Groups", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } } }