20210414061345_21041407.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace WCS.Service.Migrations
  4. {
  5. public partial class _21041407 : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropForeignKey(
  10. name: "FK_WCS_BCRDATA_WCS_DEVICEITEM_PROTOCOLID",
  11. table: "WCS_BCRDATA");
  12. migrationBuilder.DropIndex(
  13. name: "IX_WCS_BCRDATA_PROTOCOLID",
  14. table: "WCS_BCRDATA");
  15. migrationBuilder.DropColumn(
  16. name: "PROTOCOLID",
  17. table: "WCS_BCRDATA");
  18. migrationBuilder.AddColumn<string>(
  19. name: "DEVICECODE",
  20. table: "WCS_STATIONSTATUSDATA",
  21. type: "nvarchar(50)",
  22. nullable: true);
  23. migrationBuilder.AddColumn<DateTime>(
  24. name: "FRAME",
  25. table: "WCS_STATIONSTATUSDATA",
  26. type: "datetime2",
  27. nullable: false,
  28. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
  29. migrationBuilder.AddColumn<bool>(
  30. name: "ISLAST",
  31. table: "WCS_STATIONSTATUSDATA",
  32. type: "bit",
  33. nullable: false,
  34. defaultValue: false);
  35. migrationBuilder.AddColumn<string>(
  36. name: "DEVICECODE",
  37. table: "WCS_STATIONDATA",
  38. type: "nvarchar(50)",
  39. nullable: true);
  40. migrationBuilder.AddColumn<DateTime>(
  41. name: "FRAME",
  42. table: "WCS_STATIONDATA",
  43. type: "datetime2",
  44. nullable: false,
  45. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
  46. migrationBuilder.AddColumn<bool>(
  47. name: "ISLAST",
  48. table: "WCS_STATIONDATA",
  49. type: "bit",
  50. nullable: false,
  51. defaultValue: false);
  52. migrationBuilder.AddColumn<string>(
  53. name: "DEVICECODE",
  54. table: "WCS_BCRDATA",
  55. type: "nvarchar(50)",
  56. nullable: true);
  57. migrationBuilder.CreateIndex(
  58. name: "IX_WCS_STATIONSTATUSDATA_DEVICECODE",
  59. table: "WCS_STATIONSTATUSDATA",
  60. column: "DEVICECODE");
  61. migrationBuilder.CreateIndex(
  62. name: "IX_WCS_STATIONDATA_DEVICECODE",
  63. table: "WCS_STATIONDATA",
  64. column: "DEVICECODE");
  65. migrationBuilder.CreateIndex(
  66. name: "IX_WCS_BCRDATA_DEVICECODE",
  67. table: "WCS_BCRDATA",
  68. column: "DEVICECODE");
  69. migrationBuilder.AddForeignKey(
  70. name: "FK_WCS_BCRDATA_WCS_DEVICE_DEVICECODE",
  71. table: "WCS_BCRDATA",
  72. column: "DEVICECODE",
  73. principalTable: "WCS_DEVICE",
  74. principalColumn: "CODE",
  75. onDelete: ReferentialAction.Restrict);
  76. migrationBuilder.AddForeignKey(
  77. name: "FK_WCS_STATIONDATA_WCS_DEVICE_DEVICECODE",
  78. table: "WCS_STATIONDATA",
  79. column: "DEVICECODE",
  80. principalTable: "WCS_DEVICE",
  81. principalColumn: "CODE",
  82. onDelete: ReferentialAction.Restrict);
  83. migrationBuilder.AddForeignKey(
  84. name: "FK_WCS_STATIONSTATUSDATA_WCS_DEVICE_DEVICECODE",
  85. table: "WCS_STATIONSTATUSDATA",
  86. column: "DEVICECODE",
  87. principalTable: "WCS_DEVICE",
  88. principalColumn: "CODE",
  89. onDelete: ReferentialAction.Restrict);
  90. }
  91. protected override void Down(MigrationBuilder migrationBuilder)
  92. {
  93. migrationBuilder.DropForeignKey(
  94. name: "FK_WCS_BCRDATA_WCS_DEVICE_DEVICECODE",
  95. table: "WCS_BCRDATA");
  96. migrationBuilder.DropForeignKey(
  97. name: "FK_WCS_STATIONDATA_WCS_DEVICE_DEVICECODE",
  98. table: "WCS_STATIONDATA");
  99. migrationBuilder.DropForeignKey(
  100. name: "FK_WCS_STATIONSTATUSDATA_WCS_DEVICE_DEVICECODE",
  101. table: "WCS_STATIONSTATUSDATA");
  102. migrationBuilder.DropIndex(
  103. name: "IX_WCS_STATIONSTATUSDATA_DEVICECODE",
  104. table: "WCS_STATIONSTATUSDATA");
  105. migrationBuilder.DropIndex(
  106. name: "IX_WCS_STATIONDATA_DEVICECODE",
  107. table: "WCS_STATIONDATA");
  108. migrationBuilder.DropIndex(
  109. name: "IX_WCS_BCRDATA_DEVICECODE",
  110. table: "WCS_BCRDATA");
  111. migrationBuilder.DropColumn(
  112. name: "DEVICECODE",
  113. table: "WCS_STATIONSTATUSDATA");
  114. migrationBuilder.DropColumn(
  115. name: "FRAME",
  116. table: "WCS_STATIONSTATUSDATA");
  117. migrationBuilder.DropColumn(
  118. name: "ISLAST",
  119. table: "WCS_STATIONSTATUSDATA");
  120. migrationBuilder.DropColumn(
  121. name: "DEVICECODE",
  122. table: "WCS_STATIONDATA");
  123. migrationBuilder.DropColumn(
  124. name: "FRAME",
  125. table: "WCS_STATIONDATA");
  126. migrationBuilder.DropColumn(
  127. name: "ISLAST",
  128. table: "WCS_STATIONDATA");
  129. migrationBuilder.DropColumn(
  130. name: "DEVICECODE",
  131. table: "WCS_BCRDATA");
  132. migrationBuilder.AddColumn<int>(
  133. name: "PROTOCOLID",
  134. table: "WCS_BCRDATA",
  135. type: "int",
  136. nullable: true);
  137. migrationBuilder.CreateIndex(
  138. name: "IX_WCS_BCRDATA_PROTOCOLID",
  139. table: "WCS_BCRDATA",
  140. column: "PROTOCOLID");
  141. migrationBuilder.AddForeignKey(
  142. name: "FK_WCS_BCRDATA_WCS_DEVICEITEM_PROTOCOLID",
  143. table: "WCS_BCRDATA",
  144. column: "PROTOCOLID",
  145. principalTable: "WCS_DEVICEITEM",
  146. principalColumn: "ID",
  147. onDelete: ReferentialAction.Restrict);
  148. }
  149. }
  150. }