20211125051728_EditSys.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Ropin.Inspection.Model.Migrations
  4. {
  5. public partial class EditSys : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.AddColumn<string>(
  10. name: "C_LicenseCode",
  11. table: "TasksQz",
  12. type: "varchar(50) CHARACTER SET utf8mb4",
  13. maxLength: 50,
  14. nullable: false,
  15. defaultValue: "");
  16. migrationBuilder.CreateTable(
  17. name: "TSYS_Message",
  18. columns: table => new
  19. {
  20. C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
  21. C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  22. C_Type = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  23. C_Content = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: false),
  24. C_UserID = table.Column<Guid>(type: "char(36)", nullable: false),
  25. C_RelatedModule = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
  26. C_RelatedID = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
  27. C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
  28. D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
  29. C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
  30. D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
  31. C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
  32. },
  33. constraints: table =>
  34. {
  35. table.PrimaryKey("PK_TSYS_Message", x => x.C_Code);
  36. table.ForeignKey(
  37. name: "FK_TSYS_Message_TSYS_User_C_CreateBy",
  38. column: x => x.C_CreateBy,
  39. principalTable: "TSYS_User",
  40. principalColumn: "C_UserID",
  41. onDelete: ReferentialAction.Restrict);
  42. table.ForeignKey(
  43. name: "FK_TSYS_Message_TSYS_User_C_LastUpdatedBy",
  44. column: x => x.C_LastUpdatedBy,
  45. principalTable: "TSYS_User",
  46. principalColumn: "C_UserID",
  47. onDelete: ReferentialAction.Restrict);
  48. table.ForeignKey(
  49. name: "FK_TSYS_Message_TSYS_User_C_UserID",
  50. column: x => x.C_UserID,
  51. principalTable: "TSYS_User",
  52. principalColumn: "C_UserID",
  53. onDelete: ReferentialAction.Restrict);
  54. });
  55. migrationBuilder.CreateTable(
  56. name: "TSYS_Version",
  57. columns: table => new
  58. {
  59. C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
  60. C_AppCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  61. C_VersionCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  62. C_UpdateContent = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: false),
  63. C_DownloadURL = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: false),
  64. C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
  65. D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
  66. C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
  67. D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
  68. C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
  69. },
  70. constraints: table =>
  71. {
  72. table.PrimaryKey("PK_TSYS_Version", x => x.C_ID);
  73. table.ForeignKey(
  74. name: "FK_TSYS_Version_TSYS_User_C_CreateBy",
  75. column: x => x.C_CreateBy,
  76. principalTable: "TSYS_User",
  77. principalColumn: "C_UserID",
  78. onDelete: ReferentialAction.Restrict);
  79. table.ForeignKey(
  80. name: "FK_TSYS_Version_TSYS_User_C_LastUpdatedBy",
  81. column: x => x.C_LastUpdatedBy,
  82. principalTable: "TSYS_User",
  83. principalColumn: "C_UserID",
  84. onDelete: ReferentialAction.Restrict);
  85. });
  86. migrationBuilder.CreateIndex(
  87. name: "IX_TSYS_Message_C_CreateBy",
  88. table: "TSYS_Message",
  89. column: "C_CreateBy");
  90. migrationBuilder.CreateIndex(
  91. name: "IX_TSYS_Message_C_LastUpdatedBy",
  92. table: "TSYS_Message",
  93. column: "C_LastUpdatedBy");
  94. migrationBuilder.CreateIndex(
  95. name: "IX_TSYS_Message_C_UserID",
  96. table: "TSYS_Message",
  97. column: "C_UserID");
  98. migrationBuilder.CreateIndex(
  99. name: "IX_TSYS_Version_C_CreateBy",
  100. table: "TSYS_Version",
  101. column: "C_CreateBy");
  102. migrationBuilder.CreateIndex(
  103. name: "IX_TSYS_Version_C_LastUpdatedBy",
  104. table: "TSYS_Version",
  105. column: "C_LastUpdatedBy");
  106. }
  107. protected override void Down(MigrationBuilder migrationBuilder)
  108. {
  109. migrationBuilder.DropTable(
  110. name: "TSYS_Message");
  111. migrationBuilder.DropTable(
  112. name: "TSYS_Version");
  113. migrationBuilder.DropColumn(
  114. name: "C_LicenseCode",
  115. table: "TasksQz");
  116. }
  117. }
  118. }