20210903085735_9-3-1.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace WCS.Service.Migrations
  4. {
  5. public partial class _931 : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "WCS_PATHPOINT",
  11. columns: table => new
  12. {
  13. ID = table.Column<int>(type: "int", nullable: false)
  14. .Annotation("SqlServer:Identity", "1, 1"),
  15. STARTCODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  16. ENDCODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  17. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  18. PREVCODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  19. NEXTCODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  20. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  21. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  22. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  23. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  24. },
  25. constraints: table =>
  26. {
  27. table.PrimaryKey("PK_WCS_PATHPOINT", x => x.ID);
  28. table.ForeignKey(
  29. name: "FK_WCS_PATHPOINT_WCS_DEVICE_DEVICECODE",
  30. column: x => x.DEVICECODE,
  31. principalTable: "WCS_DEVICE",
  32. principalColumn: "CODE",
  33. onDelete: ReferentialAction.Restrict);
  34. table.ForeignKey(
  35. name: "FK_WCS_PATHPOINT_WCS_DEVICE_ENDCODE",
  36. column: x => x.ENDCODE,
  37. principalTable: "WCS_DEVICE",
  38. principalColumn: "CODE",
  39. onDelete: ReferentialAction.Restrict);
  40. table.ForeignKey(
  41. name: "FK_WCS_PATHPOINT_WCS_DEVICE_NEXTCODE",
  42. column: x => x.NEXTCODE,
  43. principalTable: "WCS_DEVICE",
  44. principalColumn: "CODE",
  45. onDelete: ReferentialAction.Restrict);
  46. table.ForeignKey(
  47. name: "FK_WCS_PATHPOINT_WCS_DEVICE_PREVCODE",
  48. column: x => x.PREVCODE,
  49. principalTable: "WCS_DEVICE",
  50. principalColumn: "CODE",
  51. onDelete: ReferentialAction.Restrict);
  52. table.ForeignKey(
  53. name: "FK_WCS_PATHPOINT_WCS_DEVICE_STARTCODE",
  54. column: x => x.STARTCODE,
  55. principalTable: "WCS_DEVICE",
  56. principalColumn: "CODE",
  57. onDelete: ReferentialAction.Restrict);
  58. });
  59. migrationBuilder.CreateIndex(
  60. name: "IX_WCS_PATHPOINT_DEVICECODE",
  61. table: "WCS_PATHPOINT",
  62. column: "DEVICECODE");
  63. migrationBuilder.CreateIndex(
  64. name: "IX_WCS_PATHPOINT_ENDCODE",
  65. table: "WCS_PATHPOINT",
  66. column: "ENDCODE");
  67. migrationBuilder.CreateIndex(
  68. name: "IX_WCS_PATHPOINT_NEXTCODE",
  69. table: "WCS_PATHPOINT",
  70. column: "NEXTCODE");
  71. migrationBuilder.CreateIndex(
  72. name: "IX_WCS_PATHPOINT_PREVCODE",
  73. table: "WCS_PATHPOINT",
  74. column: "PREVCODE");
  75. migrationBuilder.CreateIndex(
  76. name: "IX_WCS_PATHPOINT_STARTCODE",
  77. table: "WCS_PATHPOINT",
  78. column: "STARTCODE");
  79. }
  80. protected override void Down(MigrationBuilder migrationBuilder)
  81. {
  82. migrationBuilder.DropTable(
  83. name: "WCS_PATHPOINT");
  84. }
  85. }
  86. }