You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9 KiB

  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace EF_Code_First.Migrations
  4. {
  5. public partial class V02 : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropForeignKey(
  10. name: "FK_Students_Grade_GradeId",
  11. table: "Students");
  12. migrationBuilder.DropPrimaryKey(
  13. name: "PK_Grade",
  14. table: "Grade");
  15. migrationBuilder.RenameTable(
  16. name: "Grade",
  17. newName: "Grades");
  18. migrationBuilder.AddPrimaryKey(
  19. name: "PK_Grades",
  20. table: "Grades",
  21. column: "GradeId");
  22. migrationBuilder.AddForeignKey(
  23. name: "FK_Students_Grades_GradeId",
  24. table: "Students",
  25. column: "GradeId",
  26. principalTable: "Grades",
  27. principalColumn: "GradeId",
  28. onDelete: ReferentialAction.Cascade);
  29. }
  30. protected override void Down(MigrationBuilder migrationBuilder)
  31. {
  32. migrationBuilder.DropForeignKey(
  33. name: "FK_Students_Grades_GradeId",
  34. table: "Students");
  35. migrationBuilder.DropPrimaryKey(
  36. name: "PK_Grades",
  37. table: "Grades");
  38. migrationBuilder.RenameTable(
  39. name: "Grades",
  40. newName: "Grade");
  41. migrationBuilder.AddPrimaryKey(
  42. name: "PK_Grade",
  43. table: "Grade",
  44. column: "GradeId");
  45. migrationBuilder.AddForeignKey(
  46. name: "FK_Students_Grade_GradeId",
  47. table: "Students",
  48. column: "GradeId",
  49. principalTable: "Grade",
  50. principalColumn: "GradeId");
  51. }
  52. }
  53. }