20210720013515_7-20-3.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace WCS.Service.Migrations
  4. {
  5. public partial class _7203 : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.AddColumn<string>(
  10. name: "DEVICECODE",
  11. table: "WCS_RobotStation",
  12. type: "nvarchar(50)",
  13. nullable: true);
  14. migrationBuilder.AddColumn<DateTime>(
  15. name: "FRAME",
  16. table: "WCS_RobotStation",
  17. type: "datetime2",
  18. nullable: false,
  19. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
  20. migrationBuilder.AddColumn<bool>(
  21. name: "ISLAST",
  22. table: "WCS_RobotStation",
  23. type: "bit",
  24. nullable: false,
  25. defaultValue: false);
  26. migrationBuilder.AddColumn<int>(
  27. name: "WCSVERSION",
  28. table: "WCS_RobotStation",
  29. type: "int",
  30. nullable: false,
  31. defaultValue: 0);
  32. migrationBuilder.AddColumn<string>(
  33. name: "DEVICECODE",
  34. table: "WCS_Robot",
  35. type: "nvarchar(50)",
  36. nullable: true);
  37. migrationBuilder.AddColumn<DateTime>(
  38. name: "FRAME",
  39. table: "WCS_Robot",
  40. type: "datetime2",
  41. nullable: false,
  42. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
  43. migrationBuilder.AddColumn<bool>(
  44. name: "ISLAST",
  45. table: "WCS_Robot",
  46. type: "bit",
  47. nullable: false,
  48. defaultValue: false);
  49. migrationBuilder.AddColumn<int>(
  50. name: "WCSVERSION",
  51. table: "WCS_Robot",
  52. type: "int",
  53. nullable: false,
  54. defaultValue: 0);
  55. migrationBuilder.CreateIndex(
  56. name: "IX_WCS_RobotStation_DEVICECODE",
  57. table: "WCS_RobotStation",
  58. column: "DEVICECODE");
  59. migrationBuilder.CreateIndex(
  60. name: "IX_WCS_Robot_DEVICECODE",
  61. table: "WCS_Robot",
  62. column: "DEVICECODE");
  63. migrationBuilder.AddForeignKey(
  64. name: "FK_WCS_Robot_WCS_DEVICE_DEVICECODE",
  65. table: "WCS_Robot",
  66. column: "DEVICECODE",
  67. principalTable: "WCS_DEVICE",
  68. principalColumn: "CODE",
  69. onDelete: ReferentialAction.Restrict);
  70. migrationBuilder.AddForeignKey(
  71. name: "FK_WCS_RobotStation_WCS_DEVICE_DEVICECODE",
  72. table: "WCS_RobotStation",
  73. column: "DEVICECODE",
  74. principalTable: "WCS_DEVICE",
  75. principalColumn: "CODE",
  76. onDelete: ReferentialAction.Restrict);
  77. }
  78. protected override void Down(MigrationBuilder migrationBuilder)
  79. {
  80. migrationBuilder.DropForeignKey(
  81. name: "FK_WCS_Robot_WCS_DEVICE_DEVICECODE",
  82. table: "WCS_Robot");
  83. migrationBuilder.DropForeignKey(
  84. name: "FK_WCS_RobotStation_WCS_DEVICE_DEVICECODE",
  85. table: "WCS_RobotStation");
  86. migrationBuilder.DropIndex(
  87. name: "IX_WCS_RobotStation_DEVICECODE",
  88. table: "WCS_RobotStation");
  89. migrationBuilder.DropIndex(
  90. name: "IX_WCS_Robot_DEVICECODE",
  91. table: "WCS_Robot");
  92. migrationBuilder.DropColumn(
  93. name: "DEVICECODE",
  94. table: "WCS_RobotStation");
  95. migrationBuilder.DropColumn(
  96. name: "FRAME",
  97. table: "WCS_RobotStation");
  98. migrationBuilder.DropColumn(
  99. name: "ISLAST",
  100. table: "WCS_RobotStation");
  101. migrationBuilder.DropColumn(
  102. name: "WCSVERSION",
  103. table: "WCS_RobotStation");
  104. migrationBuilder.DropColumn(
  105. name: "DEVICECODE",
  106. table: "WCS_Robot");
  107. migrationBuilder.DropColumn(
  108. name: "FRAME",
  109. table: "WCS_Robot");
  110. migrationBuilder.DropColumn(
  111. name: "ISLAST",
  112. table: "WCS_Robot");
  113. migrationBuilder.DropColumn(
  114. name: "WCSVERSION",
  115. table: "WCS_Robot");
  116. }
  117. }
  118. }