20220405050833_5.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace WCS.Service.Migrations
  4. {
  5. public partial class _5 : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropForeignKey(
  10. name: "FK_WCS_DEVICEGROUP_WCS_DEVICE_GROUPCODE",
  11. table: "WCS_DEVICEGROUP");
  12. migrationBuilder.DropForeignKey(
  13. name: "FK_WCS_DEVICEGROUP_WCS_DEVICE_MEMBERCODE",
  14. table: "WCS_DEVICEGROUP");
  15. migrationBuilder.DropPrimaryKey(
  16. name: "PK_WCS_DEVICEGROUP",
  17. table: "WCS_DEVICEGROUP");
  18. migrationBuilder.RenameTable(
  19. name: "WCS_DEVICEGROUP",
  20. newName: "WCS_GROUPMEMBER");
  21. migrationBuilder.RenameIndex(
  22. name: "IX_WCS_DEVICEGROUP_MEMBERCODE",
  23. table: "WCS_GROUPMEMBER",
  24. newName: "IX_WCS_GROUPMEMBER_MEMBERCODE");
  25. migrationBuilder.RenameIndex(
  26. name: "IX_WCS_DEVICEGROUP_GROUPCODE",
  27. table: "WCS_GROUPMEMBER",
  28. newName: "IX_WCS_GROUPMEMBER_GROUPCODE");
  29. migrationBuilder.AddPrimaryKey(
  30. name: "PK_WCS_GROUPMEMBER",
  31. table: "WCS_GROUPMEMBER",
  32. column: "ID");
  33. migrationBuilder.AddForeignKey(
  34. name: "FK_WCS_GROUPMEMBER_WCS_DEVICE_GROUPCODE",
  35. table: "WCS_GROUPMEMBER",
  36. column: "GROUPCODE",
  37. principalTable: "WCS_DEVICE",
  38. principalColumn: "CODE",
  39. onDelete: ReferentialAction.Restrict);
  40. migrationBuilder.AddForeignKey(
  41. name: "FK_WCS_GROUPMEMBER_WCS_DEVICE_MEMBERCODE",
  42. table: "WCS_GROUPMEMBER",
  43. column: "MEMBERCODE",
  44. principalTable: "WCS_DEVICE",
  45. principalColumn: "CODE",
  46. onDelete: ReferentialAction.Restrict);
  47. }
  48. protected override void Down(MigrationBuilder migrationBuilder)
  49. {
  50. migrationBuilder.DropForeignKey(
  51. name: "FK_WCS_GROUPMEMBER_WCS_DEVICE_GROUPCODE",
  52. table: "WCS_GROUPMEMBER");
  53. migrationBuilder.DropForeignKey(
  54. name: "FK_WCS_GROUPMEMBER_WCS_DEVICE_MEMBERCODE",
  55. table: "WCS_GROUPMEMBER");
  56. migrationBuilder.DropPrimaryKey(
  57. name: "PK_WCS_GROUPMEMBER",
  58. table: "WCS_GROUPMEMBER");
  59. migrationBuilder.RenameTable(
  60. name: "WCS_GROUPMEMBER",
  61. newName: "WCS_DEVICEGROUP");
  62. migrationBuilder.RenameIndex(
  63. name: "IX_WCS_GROUPMEMBER_MEMBERCODE",
  64. table: "WCS_DEVICEGROUP",
  65. newName: "IX_WCS_DEVICEGROUP_MEMBERCODE");
  66. migrationBuilder.RenameIndex(
  67. name: "IX_WCS_GROUPMEMBER_GROUPCODE",
  68. table: "WCS_DEVICEGROUP",
  69. newName: "IX_WCS_DEVICEGROUP_GROUPCODE");
  70. migrationBuilder.AddPrimaryKey(
  71. name: "PK_WCS_DEVICEGROUP",
  72. table: "WCS_DEVICEGROUP",
  73. column: "ID");
  74. migrationBuilder.AddForeignKey(
  75. name: "FK_WCS_DEVICEGROUP_WCS_DEVICE_GROUPCODE",
  76. table: "WCS_DEVICEGROUP",
  77. column: "GROUPCODE",
  78. principalTable: "WCS_DEVICE",
  79. principalColumn: "CODE",
  80. onDelete: ReferentialAction.Restrict);
  81. migrationBuilder.AddForeignKey(
  82. name: "FK_WCS_DEVICEGROUP_WCS_DEVICE_MEMBERCODE",
  83. table: "WCS_DEVICEGROUP",
  84. column: "MEMBERCODE",
  85. principalTable: "WCS_DEVICE",
  86. principalColumn: "CODE",
  87. onDelete: ReferentialAction.Restrict);
  88. }
  89. }
  90. }