20211125070245_EditPNT.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Ropin.Inspection.Model.Migrations
  4. {
  5. public partial class EditPNT : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "TPNT_Area",
  11. columns: table => new
  12. {
  13. C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
  14. C_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  15. C_Name = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
  16. C_SName = table.Column<string>(type: "varchar(16) CHARACTER SET utf8mb4", maxLength: 16, nullable: true),
  17. C_ImageUrl = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true),
  18. I_Sort = table.Column<int>(type: "int", nullable: false),
  19. C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
  20. C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
  21. D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
  22. C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
  23. D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
  24. C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
  25. },
  26. constraints: table =>
  27. {
  28. table.PrimaryKey("PK_TPNT_Area", x => x.C_Code);
  29. table.ForeignKey(
  30. name: "FK_TPNT_Area_TSYS_User_C_CreateBy",
  31. column: x => x.C_CreateBy,
  32. principalTable: "TSYS_User",
  33. principalColumn: "C_UserID",
  34. onDelete: ReferentialAction.Restrict);
  35. table.ForeignKey(
  36. name: "FK_TPNT_Area_TSYS_User_C_LastUpdatedBy",
  37. column: x => x.C_LastUpdatedBy,
  38. principalTable: "TSYS_User",
  39. principalColumn: "C_UserID",
  40. onDelete: ReferentialAction.Restrict);
  41. });
  42. migrationBuilder.CreateTable(
  43. name: "TPNT_Store",
  44. columns: table => new
  45. {
  46. C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
  47. C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  48. C_AreaCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
  49. C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  50. C_Name = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
  51. C_SName = table.Column<string>(type: "varchar(16) CHARACTER SET utf8mb4", maxLength: 16, nullable: true),
  52. C_TypeCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  53. C_Address = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
  54. C_GPS = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
  55. I_Sort = table.Column<int>(type: "int", nullable: false),
  56. C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
  57. C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
  58. D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
  59. C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
  60. D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
  61. C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
  62. },
  63. constraints: table =>
  64. {
  65. table.PrimaryKey("PK_TPNT_Store", x => x.C_ID);
  66. table.ForeignKey(
  67. name: "FK_TPNT_Store_TBDM_Area_C_AreaCode",
  68. column: x => x.C_AreaCode,
  69. principalTable: "TBDM_Area",
  70. principalColumn: "C_Code",
  71. onDelete: ReferentialAction.Restrict);
  72. table.ForeignKey(
  73. name: "FK_TPNT_Store_TSYS_User_C_CreateBy",
  74. column: x => x.C_CreateBy,
  75. principalTable: "TSYS_User",
  76. principalColumn: "C_UserID",
  77. onDelete: ReferentialAction.Restrict);
  78. table.ForeignKey(
  79. name: "FK_TPNT_Store_TSYS_User_C_LastUpdatedBy",
  80. column: x => x.C_LastUpdatedBy,
  81. principalTable: "TSYS_User",
  82. principalColumn: "C_UserID",
  83. onDelete: ReferentialAction.Restrict);
  84. //table.ForeignKey(
  85. // name: "FK_TSYS_LicenseTPNT_Store_Code",
  86. // column: x => x.C_LicenseCode,
  87. // principalTable: "TSYS_License",
  88. // principalColumn: "C_Code",
  89. // onDelete: ReferentialAction.Restrict);
  90. });
  91. migrationBuilder.CreateTable(
  92. name: "TPNT_StoreOrg",
  93. columns: table => new
  94. {
  95. C_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  96. C_OrgCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  97. C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
  98. D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
  99. },
  100. constraints: table =>
  101. {
  102. table.PrimaryKey("PK_TPNT_StoreOrg", x => new { x.C_StoreCode, x.C_OrgCode });
  103. table.ForeignKey(
  104. name: "FK_TPNT_StoreOrg_TSYS_User_C_CreateBy",
  105. column: x => x.C_CreateBy,
  106. principalTable: "TSYS_User",
  107. principalColumn: "C_UserID",
  108. onDelete: ReferentialAction.Restrict);
  109. });
  110. migrationBuilder.CreateTable(
  111. name: "TPNT_Type",
  112. columns: table => new
  113. {
  114. C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
  115. C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
  116. I_Sort = table.Column<int>(type: "int", nullable: false),
  117. C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
  118. },
  119. constraints: table =>
  120. {
  121. table.PrimaryKey("PK_TPNT_Type", x => x.C_Code);
  122. });
  123. migrationBuilder.CreateIndex(
  124. name: "IX_TPNT_Area_C_CreateBy",
  125. table: "TPNT_Area",
  126. column: "C_CreateBy");
  127. migrationBuilder.CreateIndex(
  128. name: "IX_TPNT_Area_C_LastUpdatedBy",
  129. table: "TPNT_Area",
  130. column: "C_LastUpdatedBy");
  131. migrationBuilder.CreateIndex(
  132. name: "IX_TPNT_Store_C_AreaCode",
  133. table: "TPNT_Store",
  134. column: "C_AreaCode");
  135. migrationBuilder.CreateIndex(
  136. name: "IX_TPNT_Store_C_CreateBy",
  137. table: "TPNT_Store",
  138. column: "C_CreateBy");
  139. migrationBuilder.CreateIndex(
  140. name: "IX_TPNT_Store_C_LastUpdatedBy",
  141. table: "TPNT_Store",
  142. column: "C_LastUpdatedBy");
  143. migrationBuilder.CreateIndex(
  144. name: "IX_TPNT_StoreOrg_C_CreateBy",
  145. table: "TPNT_StoreOrg",
  146. column: "C_CreateBy");
  147. }
  148. protected override void Down(MigrationBuilder migrationBuilder)
  149. {
  150. migrationBuilder.DropTable(
  151. name: "TPNT_Area");
  152. migrationBuilder.DropTable(
  153. name: "TPNT_Store");
  154. migrationBuilder.DropTable(
  155. name: "TPNT_StoreOrg");
  156. migrationBuilder.DropTable(
  157. name: "TPNT_Type");
  158. }
  159. }
  160. }