Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

20230224083501_SetFileEntityCategoryToBeNullable.cs 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace Diligent.WebAPI.Data.Migrations
  4. {
  5. public partial class SetFileEntityCategoryToBeNullable : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropForeignKey(
  10. name: "FK_Files_Categories_CategoryId",
  11. table: "Files");
  12. migrationBuilder.AlterColumn<int>(
  13. name: "CategoryId",
  14. table: "Files",
  15. type: "int",
  16. nullable: true,
  17. oldClrType: typeof(int),
  18. oldType: "int");
  19. migrationBuilder.AddForeignKey(
  20. name: "FK_Files_Categories_CategoryId",
  21. table: "Files",
  22. column: "CategoryId",
  23. principalTable: "Categories",
  24. principalColumn: "Id");
  25. }
  26. protected override void Down(MigrationBuilder migrationBuilder)
  27. {
  28. migrationBuilder.DropForeignKey(
  29. name: "FK_Files_Categories_CategoryId",
  30. table: "Files");
  31. migrationBuilder.AlterColumn<int>(
  32. name: "CategoryId",
  33. table: "Files",
  34. type: "int",
  35. nullable: false,
  36. defaultValue: 0,
  37. oldClrType: typeof(int),
  38. oldType: "int",
  39. oldNullable: true);
  40. migrationBuilder.AddForeignKey(
  41. name: "FK_Files_Categories_CategoryId",
  42. table: "Files",
  43. column: "CategoryId",
  44. principalTable: "Categories",
  45. principalColumn: "Id",
  46. onDelete: ReferentialAction.Cascade);
  47. }
  48. }
  49. }