20220405050523_4.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace WCS.Service.Migrations
  5. {
  6. public partial class _4 : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "WCS_DEVICEGROUP",
  12. columns: table => new
  13. {
  14. ID = table.Column<int>(type: "int", nullable: false)
  15. .Annotation("SqlServer:Identity", "1, 1"),
  16. GROUPCODE = table.Column<string>(type: "nvarchar(50)", nullable: false),
  17. MEMBERCODE = table.Column<string>(type: "nvarchar(50)", nullable: false),
  18. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  19. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  20. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  21. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  22. },
  23. constraints: table =>
  24. {
  25. table.PrimaryKey("PK_WCS_DEVICEGROUP", x => x.ID);
  26. table.ForeignKey(
  27. name: "FK_WCS_DEVICEGROUP_WCS_DEVICE_GROUPCODE",
  28. column: x => x.GROUPCODE,
  29. principalTable: "WCS_DEVICE",
  30. principalColumn: "CODE",
  31. onDelete: ReferentialAction.Restrict);
  32. table.ForeignKey(
  33. name: "FK_WCS_DEVICEGROUP_WCS_DEVICE_MEMBERCODE",
  34. column: x => x.MEMBERCODE,
  35. principalTable: "WCS_DEVICE",
  36. principalColumn: "CODE",
  37. onDelete: ReferentialAction.Restrict);
  38. });
  39. migrationBuilder.CreateIndex(
  40. name: "IX_WCS_DEVICEGROUP_GROUPCODE",
  41. table: "WCS_DEVICEGROUP",
  42. column: "GROUPCODE");
  43. migrationBuilder.CreateIndex(
  44. name: "IX_WCS_DEVICEGROUP_MEMBERCODE",
  45. table: "WCS_DEVICEGROUP",
  46. column: "MEMBERCODE");
  47. }
  48. protected override void Down(MigrationBuilder migrationBuilder)
  49. {
  50. migrationBuilder.DropTable(
  51. name: "WCS_DEVICEGROUP");
  52. }
  53. }
  54. }