20210320162107_identity.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. using MySql.EntityFrameworkCore.Metadata;
  4. namespace HyperCube.Migrations
  5. {
  6. public partial class identity : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "AspNetRoles",
  12. columns: table => new
  13. {
  14. Id = table.Column<string>(type: "varchar(767)", nullable: false),
  15. Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true),
  16. NormalizedName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true),
  17. ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
  18. },
  19. constraints: table =>
  20. {
  21. table.PrimaryKey("PK_AspNetRoles", x => x.Id);
  22. });
  23. migrationBuilder.CreateTable(
  24. name: "AspNetUsers",
  25. columns: table => new
  26. {
  27. Id = table.Column<string>(type: "varchar(767)", nullable: false),
  28. UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true),
  29. NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true),
  30. Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true),
  31. NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true),
  32. EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
  33. PasswordHash = table.Column<string>(type: "text", nullable: true),
  34. SecurityStamp = table.Column<string>(type: "text", nullable: true),
  35. ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
  36. PhoneNumber = table.Column<string>(type: "text", nullable: true),
  37. PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
  38. TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
  39. LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp", nullable: true),
  40. LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
  41. AccessFailedCount = table.Column<int>(type: "int", nullable: false)
  42. },
  43. constraints: table =>
  44. {
  45. table.PrimaryKey("PK_AspNetUsers", x => x.Id);
  46. });
  47. migrationBuilder.CreateTable(
  48. name: "AspNetRoleClaims",
  49. columns: table => new
  50. {
  51. Id = table.Column<int>(type: "int", nullable: false)
  52. .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
  53. RoleId = table.Column<string>(type: "varchar(767)", nullable: false),
  54. ClaimType = table.Column<string>(type: "text", nullable: true),
  55. ClaimValue = table.Column<string>(type: "text", nullable: true)
  56. },
  57. constraints: table =>
  58. {
  59. table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
  60. table.ForeignKey(
  61. name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
  62. column: x => x.RoleId,
  63. principalTable: "AspNetRoles",
  64. principalColumn: "Id",
  65. onDelete: ReferentialAction.Cascade);
  66. });
  67. migrationBuilder.CreateTable(
  68. name: "AspNetUserClaims",
  69. columns: table => new
  70. {
  71. Id = table.Column<int>(type: "int", nullable: false)
  72. .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
  73. UserId = table.Column<string>(type: "varchar(767)", nullable: false),
  74. ClaimType = table.Column<string>(type: "text", nullable: true),
  75. ClaimValue = table.Column<string>(type: "text", nullable: true)
  76. },
  77. constraints: table =>
  78. {
  79. table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
  80. table.ForeignKey(
  81. name: "FK_AspNetUserClaims_AspNetUsers_UserId",
  82. column: x => x.UserId,
  83. principalTable: "AspNetUsers",
  84. principalColumn: "Id",
  85. onDelete: ReferentialAction.Cascade);
  86. });
  87. migrationBuilder.CreateTable(
  88. name: "AspNetUserLogins",
  89. columns: table => new
  90. {
  91. LoginProvider = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false),
  92. ProviderKey = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false),
  93. ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
  94. UserId = table.Column<string>(type: "varchar(767)", nullable: false)
  95. },
  96. constraints: table =>
  97. {
  98. table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
  99. table.ForeignKey(
  100. name: "FK_AspNetUserLogins_AspNetUsers_UserId",
  101. column: x => x.UserId,
  102. principalTable: "AspNetUsers",
  103. principalColumn: "Id",
  104. onDelete: ReferentialAction.Cascade);
  105. });
  106. migrationBuilder.CreateTable(
  107. name: "AspNetUserRoles",
  108. columns: table => new
  109. {
  110. UserId = table.Column<string>(type: "varchar(767)", nullable: false),
  111. RoleId = table.Column<string>(type: "varchar(767)", nullable: false)
  112. },
  113. constraints: table =>
  114. {
  115. table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
  116. table.ForeignKey(
  117. name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
  118. column: x => x.RoleId,
  119. principalTable: "AspNetRoles",
  120. principalColumn: "Id",
  121. onDelete: ReferentialAction.Cascade);
  122. table.ForeignKey(
  123. name: "FK_AspNetUserRoles_AspNetUsers_UserId",
  124. column: x => x.UserId,
  125. principalTable: "AspNetUsers",
  126. principalColumn: "Id",
  127. onDelete: ReferentialAction.Cascade);
  128. });
  129. migrationBuilder.CreateTable(
  130. name: "AspNetUserTokens",
  131. columns: table => new
  132. {
  133. UserId = table.Column<string>(type: "varchar(767)", nullable: false),
  134. LoginProvider = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false),
  135. Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false),
  136. Value = table.Column<string>(type: "text", nullable: true)
  137. },
  138. constraints: table =>
  139. {
  140. table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
  141. table.ForeignKey(
  142. name: "FK_AspNetUserTokens_AspNetUsers_UserId",
  143. column: x => x.UserId,
  144. principalTable: "AspNetUsers",
  145. principalColumn: "Id",
  146. onDelete: ReferentialAction.Cascade);
  147. });
  148. migrationBuilder.CreateIndex(
  149. name: "IX_AspNetRoleClaims_RoleId",
  150. table: "AspNetRoleClaims",
  151. column: "RoleId");
  152. migrationBuilder.CreateIndex(
  153. name: "RoleNameIndex",
  154. table: "AspNetRoles",
  155. column: "NormalizedName",
  156. unique: true);
  157. migrationBuilder.CreateIndex(
  158. name: "IX_AspNetUserClaims_UserId",
  159. table: "AspNetUserClaims",
  160. column: "UserId");
  161. migrationBuilder.CreateIndex(
  162. name: "IX_AspNetUserLogins_UserId",
  163. table: "AspNetUserLogins",
  164. column: "UserId");
  165. migrationBuilder.CreateIndex(
  166. name: "IX_AspNetUserRoles_RoleId",
  167. table: "AspNetUserRoles",
  168. column: "RoleId");
  169. migrationBuilder.CreateIndex(
  170. name: "EmailIndex",
  171. table: "AspNetUsers",
  172. column: "NormalizedEmail");
  173. migrationBuilder.CreateIndex(
  174. name: "UserNameIndex",
  175. table: "AspNetUsers",
  176. column: "NormalizedUserName",
  177. unique: true);
  178. }
  179. protected override void Down(MigrationBuilder migrationBuilder)
  180. {
  181. migrationBuilder.DropTable(
  182. name: "AspNetRoleClaims");
  183. migrationBuilder.DropTable(
  184. name: "AspNetUserClaims");
  185. migrationBuilder.DropTable(
  186. name: "AspNetUserLogins");
  187. migrationBuilder.DropTable(
  188. name: "AspNetUserRoles");
  189. migrationBuilder.DropTable(
  190. name: "AspNetUserTokens");
  191. migrationBuilder.DropTable(
  192. name: "AspNetRoles");
  193. migrationBuilder.DropTable(
  194. name: "AspNetUsers");
  195. }
  196. }
  197. }