20230131062132_inint.cs 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace AuthServer.Host.Migrations
  5. {
  6. public partial class inint : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.AlterDatabase()
  11. .Annotation("MySql:CharSet", "utf8mb4");
  12. migrationBuilder.CreateTable(
  13. name: "IdentityServerApiResources",
  14. columns: table => new
  15. {
  16. Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  17. Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  18. .Annotation("MySql:CharSet", "utf8mb4"),
  19. DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  20. .Annotation("MySql:CharSet", "utf8mb4"),
  21. Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true)
  22. .Annotation("MySql:CharSet", "utf8mb4"),
  23. Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
  24. AllowedAccessTokenSigningAlgorithms = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
  25. .Annotation("MySql:CharSet", "utf8mb4"),
  26. ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false),
  27. ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
  28. .Annotation("MySql:CharSet", "utf8mb4"),
  29. ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
  30. .Annotation("MySql:CharSet", "utf8mb4"),
  31. CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
  32. CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  33. LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
  34. LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  35. IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
  36. DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  37. DeletionTime = table.Column<DateTime>(type: "datetime", nullable: true)
  38. },
  39. constraints: table =>
  40. {
  41. table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id);
  42. })
  43. .Annotation("MySql:CharSet", "utf8mb4");
  44. migrationBuilder.CreateTable(
  45. name: "IdentityServerApiScopes",
  46. columns: table => new
  47. {
  48. Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  49. Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
  50. Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  51. .Annotation("MySql:CharSet", "utf8mb4"),
  52. DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  53. .Annotation("MySql:CharSet", "utf8mb4"),
  54. Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true)
  55. .Annotation("MySql:CharSet", "utf8mb4"),
  56. Required = table.Column<bool>(type: "tinyint(1)", nullable: false),
  57. Emphasize = table.Column<bool>(type: "tinyint(1)", nullable: false),
  58. ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false),
  59. ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
  60. .Annotation("MySql:CharSet", "utf8mb4"),
  61. ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
  62. .Annotation("MySql:CharSet", "utf8mb4"),
  63. CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
  64. CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  65. LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
  66. LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  67. IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
  68. DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  69. DeletionTime = table.Column<DateTime>(type: "datetime", nullable: true)
  70. },
  71. constraints: table =>
  72. {
  73. table.PrimaryKey("PK_IdentityServerApiScopes", x => x.Id);
  74. })
  75. .Annotation("MySql:CharSet", "utf8mb4");
  76. migrationBuilder.CreateTable(
  77. name: "IdentityServerClients",
  78. columns: table => new
  79. {
  80. Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  81. ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  82. .Annotation("MySql:CharSet", "utf8mb4"),
  83. ClientName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  84. .Annotation("MySql:CharSet", "utf8mb4"),
  85. Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true)
  86. .Annotation("MySql:CharSet", "utf8mb4"),
  87. ClientUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
  88. .Annotation("MySql:CharSet", "utf8mb4"),
  89. LogoUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
  90. .Annotation("MySql:CharSet", "utf8mb4"),
  91. Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
  92. ProtocolType = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  93. .Annotation("MySql:CharSet", "utf8mb4"),
  94. RequireClientSecret = table.Column<bool>(type: "tinyint(1)", nullable: false),
  95. RequireConsent = table.Column<bool>(type: "tinyint(1)", nullable: false),
  96. AllowRememberConsent = table.Column<bool>(type: "tinyint(1)", nullable: false),
  97. AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "tinyint(1)", nullable: false),
  98. RequirePkce = table.Column<bool>(type: "tinyint(1)", nullable: false),
  99. AllowPlainTextPkce = table.Column<bool>(type: "tinyint(1)", nullable: false),
  100. RequireRequestObject = table.Column<bool>(type: "tinyint(1)", nullable: false),
  101. AllowAccessTokensViaBrowser = table.Column<bool>(type: "tinyint(1)", nullable: false),
  102. FrontChannelLogoutUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
  103. .Annotation("MySql:CharSet", "utf8mb4"),
  104. FrontChannelLogoutSessionRequired = table.Column<bool>(type: "tinyint(1)", nullable: false),
  105. BackChannelLogoutUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
  106. .Annotation("MySql:CharSet", "utf8mb4"),
  107. BackChannelLogoutSessionRequired = table.Column<bool>(type: "tinyint(1)", nullable: false),
  108. AllowOfflineAccess = table.Column<bool>(type: "tinyint(1)", nullable: false),
  109. IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false),
  110. AllowedIdentityTokenSigningAlgorithms = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
  111. .Annotation("MySql:CharSet", "utf8mb4"),
  112. AccessTokenLifetime = table.Column<int>(type: "int", nullable: false),
  113. AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false),
  114. ConsentLifetime = table.Column<int>(type: "int", nullable: true),
  115. AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
  116. SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
  117. RefreshTokenUsage = table.Column<int>(type: "int", nullable: false),
  118. UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "tinyint(1)", nullable: false),
  119. RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false),
  120. AccessTokenType = table.Column<int>(type: "int", nullable: false),
  121. EnableLocalLogin = table.Column<bool>(type: "tinyint(1)", nullable: false),
  122. IncludeJwtId = table.Column<bool>(type: "tinyint(1)", nullable: false),
  123. AlwaysSendClientClaims = table.Column<bool>(type: "tinyint(1)", nullable: false),
  124. ClientClaimsPrefix = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  125. .Annotation("MySql:CharSet", "utf8mb4"),
  126. PairWiseSubjectSalt = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  127. .Annotation("MySql:CharSet", "utf8mb4"),
  128. UserSsoLifetime = table.Column<int>(type: "int", nullable: true),
  129. UserCodeType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
  130. .Annotation("MySql:CharSet", "utf8mb4"),
  131. DeviceCodeLifetime = table.Column<int>(type: "int", nullable: false),
  132. ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
  133. .Annotation("MySql:CharSet", "utf8mb4"),
  134. ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
  135. .Annotation("MySql:CharSet", "utf8mb4"),
  136. CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
  137. CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  138. LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
  139. LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  140. IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
  141. DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  142. DeletionTime = table.Column<DateTime>(type: "datetime", nullable: true)
  143. },
  144. constraints: table =>
  145. {
  146. table.PrimaryKey("PK_IdentityServerClients", x => x.Id);
  147. })
  148. .Annotation("MySql:CharSet", "utf8mb4");
  149. migrationBuilder.CreateTable(
  150. name: "IdentityServerDeviceFlowCodes",
  151. columns: table => new
  152. {
  153. Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  154. DeviceCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  155. .Annotation("MySql:CharSet", "utf8mb4"),
  156. UserCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  157. .Annotation("MySql:CharSet", "utf8mb4"),
  158. SubjectId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  159. .Annotation("MySql:CharSet", "utf8mb4"),
  160. SessionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
  161. .Annotation("MySql:CharSet", "utf8mb4"),
  162. ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  163. .Annotation("MySql:CharSet", "utf8mb4"),
  164. Description = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  165. .Annotation("MySql:CharSet", "utf8mb4"),
  166. Expiration = table.Column<DateTime>(type: "datetime", nullable: false),
  167. Data = table.Column<string>(type: "varchar(10000)", maxLength: 10000, nullable: false)
  168. .Annotation("MySql:CharSet", "utf8mb4"),
  169. ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
  170. .Annotation("MySql:CharSet", "utf8mb4"),
  171. ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
  172. .Annotation("MySql:CharSet", "utf8mb4"),
  173. CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
  174. CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
  175. },
  176. constraints: table =>
  177. {
  178. table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id);
  179. })
  180. .Annotation("MySql:CharSet", "utf8mb4");
  181. migrationBuilder.CreateTable(
  182. name: "IdentityServerIdentityResources",
  183. columns: table => new
  184. {
  185. Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  186. Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  187. .Annotation("MySql:CharSet", "utf8mb4"),
  188. DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  189. .Annotation("MySql:CharSet", "utf8mb4"),
  190. Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true)
  191. .Annotation("MySql:CharSet", "utf8mb4"),
  192. Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
  193. Required = table.Column<bool>(type: "tinyint(1)", nullable: false),
  194. Emphasize = table.Column<bool>(type: "tinyint(1)", nullable: false),
  195. ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false),
  196. ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
  197. .Annotation("MySql:CharSet", "utf8mb4"),
  198. ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
  199. .Annotation("MySql:CharSet", "utf8mb4"),
  200. CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
  201. CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  202. LastModificationTime = table.Column<DateTime>(type: "datetime", nullable: true),
  203. LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  204. IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
  205. DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
  206. DeletionTime = table.Column<DateTime>(type: "datetime", nullable: true)
  207. },
  208. constraints: table =>
  209. {
  210. table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id);
  211. })
  212. .Annotation("MySql:CharSet", "utf8mb4");
  213. migrationBuilder.CreateTable(
  214. name: "IdentityServerPersistedGrants",
  215. columns: table => new
  216. {
  217. Key = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  218. .Annotation("MySql:CharSet", "utf8mb4"),
  219. Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
  220. .Annotation("MySql:CharSet", "utf8mb4"),
  221. SubjectId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  222. .Annotation("MySql:CharSet", "utf8mb4"),
  223. SessionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
  224. .Annotation("MySql:CharSet", "utf8mb4"),
  225. ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  226. .Annotation("MySql:CharSet", "utf8mb4"),
  227. Description = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
  228. .Annotation("MySql:CharSet", "utf8mb4"),
  229. CreationTime = table.Column<DateTime>(type: "datetime", nullable: false),
  230. Expiration = table.Column<DateTime>(type: "datetime", nullable: true),
  231. ConsumedTime = table.Column<DateTime>(type: "datetime", nullable: true),
  232. Data = table.Column<string>(type: "varchar(10000)", maxLength: 10000, nullable: false)
  233. .Annotation("MySql:CharSet", "utf8mb4"),
  234. Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  235. ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
  236. .Annotation("MySql:CharSet", "utf8mb4"),
  237. ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
  238. .Annotation("MySql:CharSet", "utf8mb4")
  239. },
  240. constraints: table =>
  241. {
  242. table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key);
  243. })
  244. .Annotation("MySql:CharSet", "utf8mb4");
  245. migrationBuilder.CreateTable(
  246. name: "IdentityServerApiResourceClaims",
  247. columns: table => new
  248. {
  249. Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  250. .Annotation("MySql:CharSet", "utf8mb4"),
  251. ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
  252. },
  253. constraints: table =>
  254. {
  255. table.PrimaryKey("PK_IdentityServerApiResourceClaims", x => new { x.ApiResourceId, x.Type });
  256. table.ForeignKey(
  257. name: "FK_IdentityServerApiResourceClaims_IdentityServerApiResources_A~",
  258. column: x => x.ApiResourceId,
  259. principalTable: "IdentityServerApiResources",
  260. principalColumn: "Id",
  261. onDelete: ReferentialAction.Cascade);
  262. })
  263. .Annotation("MySql:CharSet", "utf8mb4");
  264. migrationBuilder.CreateTable(
  265. name: "IdentityServerApiResourceProperties",
  266. columns: table => new
  267. {
  268. ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  269. Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  270. .Annotation("MySql:CharSet", "utf8mb4"),
  271. Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  272. .Annotation("MySql:CharSet", "utf8mb4")
  273. },
  274. constraints: table =>
  275. {
  276. table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key, x.Value });
  277. table.ForeignKey(
  278. name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResourc~",
  279. column: x => x.ApiResourceId,
  280. principalTable: "IdentityServerApiResources",
  281. principalColumn: "Id",
  282. onDelete: ReferentialAction.Cascade);
  283. })
  284. .Annotation("MySql:CharSet", "utf8mb4");
  285. migrationBuilder.CreateTable(
  286. name: "IdentityServerApiResourceScopes",
  287. columns: table => new
  288. {
  289. ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  290. Scope = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  291. .Annotation("MySql:CharSet", "utf8mb4")
  292. },
  293. constraints: table =>
  294. {
  295. table.PrimaryKey("PK_IdentityServerApiResourceScopes", x => new { x.ApiResourceId, x.Scope });
  296. table.ForeignKey(
  297. name: "FK_IdentityServerApiResourceScopes_IdentityServerApiResources_A~",
  298. column: x => x.ApiResourceId,
  299. principalTable: "IdentityServerApiResources",
  300. principalColumn: "Id",
  301. onDelete: ReferentialAction.Cascade);
  302. })
  303. .Annotation("MySql:CharSet", "utf8mb4");
  304. migrationBuilder.CreateTable(
  305. name: "IdentityServerApiResourceSecrets",
  306. columns: table => new
  307. {
  308. Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  309. .Annotation("MySql:CharSet", "utf8mb4"),
  310. Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  311. .Annotation("MySql:CharSet", "utf8mb4"),
  312. ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  313. Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true)
  314. .Annotation("MySql:CharSet", "utf8mb4"),
  315. Expiration = table.Column<DateTime>(type: "datetime", nullable: true)
  316. },
  317. constraints: table =>
  318. {
  319. table.PrimaryKey("PK_IdentityServerApiResourceSecrets", x => new { x.ApiResourceId, x.Type, x.Value });
  320. table.ForeignKey(
  321. name: "FK_IdentityServerApiResourceSecrets_IdentityServerApiResources_~",
  322. column: x => x.ApiResourceId,
  323. principalTable: "IdentityServerApiResources",
  324. principalColumn: "Id",
  325. onDelete: ReferentialAction.Cascade);
  326. })
  327. .Annotation("MySql:CharSet", "utf8mb4");
  328. migrationBuilder.CreateTable(
  329. name: "IdentityServerApiScopeClaims",
  330. columns: table => new
  331. {
  332. Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  333. .Annotation("MySql:CharSet", "utf8mb4"),
  334. ApiScopeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
  335. },
  336. constraints: table =>
  337. {
  338. table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type });
  339. table.ForeignKey(
  340. name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScop~",
  341. column: x => x.ApiScopeId,
  342. principalTable: "IdentityServerApiScopes",
  343. principalColumn: "Id",
  344. onDelete: ReferentialAction.Cascade);
  345. })
  346. .Annotation("MySql:CharSet", "utf8mb4");
  347. migrationBuilder.CreateTable(
  348. name: "IdentityServerApiScopeProperties",
  349. columns: table => new
  350. {
  351. ApiScopeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  352. Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  353. .Annotation("MySql:CharSet", "utf8mb4"),
  354. Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  355. .Annotation("MySql:CharSet", "utf8mb4")
  356. },
  357. constraints: table =>
  358. {
  359. table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key, x.Value });
  360. table.ForeignKey(
  361. name: "FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_Api~",
  362. column: x => x.ApiScopeId,
  363. principalTable: "IdentityServerApiScopes",
  364. principalColumn: "Id",
  365. onDelete: ReferentialAction.Cascade);
  366. })
  367. .Annotation("MySql:CharSet", "utf8mb4");
  368. migrationBuilder.CreateTable(
  369. name: "IdentityServerClientClaims",
  370. columns: table => new
  371. {
  372. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  373. Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  374. .Annotation("MySql:CharSet", "utf8mb4"),
  375. Value = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  376. .Annotation("MySql:CharSet", "utf8mb4")
  377. },
  378. constraints: table =>
  379. {
  380. table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value });
  381. table.ForeignKey(
  382. name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId",
  383. column: x => x.ClientId,
  384. principalTable: "IdentityServerClients",
  385. principalColumn: "Id",
  386. onDelete: ReferentialAction.Cascade);
  387. })
  388. .Annotation("MySql:CharSet", "utf8mb4");
  389. migrationBuilder.CreateTable(
  390. name: "IdentityServerClientCorsOrigins",
  391. columns: table => new
  392. {
  393. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  394. Origin = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
  395. .Annotation("MySql:CharSet", "utf8mb4")
  396. },
  397. constraints: table =>
  398. {
  399. table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin });
  400. table.ForeignKey(
  401. name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_Client~",
  402. column: x => x.ClientId,
  403. principalTable: "IdentityServerClients",
  404. principalColumn: "Id",
  405. onDelete: ReferentialAction.Cascade);
  406. })
  407. .Annotation("MySql:CharSet", "utf8mb4");
  408. migrationBuilder.CreateTable(
  409. name: "IdentityServerClientGrantTypes",
  410. columns: table => new
  411. {
  412. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  413. GrantType = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  414. .Annotation("MySql:CharSet", "utf8mb4")
  415. },
  416. constraints: table =>
  417. {
  418. table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType });
  419. table.ForeignKey(
  420. name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId",
  421. column: x => x.ClientId,
  422. principalTable: "IdentityServerClients",
  423. principalColumn: "Id",
  424. onDelete: ReferentialAction.Cascade);
  425. })
  426. .Annotation("MySql:CharSet", "utf8mb4");
  427. migrationBuilder.CreateTable(
  428. name: "IdentityServerClientIdPRestrictions",
  429. columns: table => new
  430. {
  431. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  432. Provider = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  433. .Annotation("MySql:CharSet", "utf8mb4")
  434. },
  435. constraints: table =>
  436. {
  437. table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider });
  438. table.ForeignKey(
  439. name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_Cl~",
  440. column: x => x.ClientId,
  441. principalTable: "IdentityServerClients",
  442. principalColumn: "Id",
  443. onDelete: ReferentialAction.Cascade);
  444. })
  445. .Annotation("MySql:CharSet", "utf8mb4");
  446. migrationBuilder.CreateTable(
  447. name: "IdentityServerClientPostLogoutRedirectUris",
  448. columns: table => new
  449. {
  450. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  451. PostLogoutRedirectUri = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  452. .Annotation("MySql:CharSet", "utf8mb4")
  453. },
  454. constraints: table =>
  455. {
  456. table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri });
  457. table.ForeignKey(
  458. name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerCli~",
  459. column: x => x.ClientId,
  460. principalTable: "IdentityServerClients",
  461. principalColumn: "Id",
  462. onDelete: ReferentialAction.Cascade);
  463. })
  464. .Annotation("MySql:CharSet", "utf8mb4");
  465. migrationBuilder.CreateTable(
  466. name: "IdentityServerClientProperties",
  467. columns: table => new
  468. {
  469. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  470. Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  471. .Annotation("MySql:CharSet", "utf8mb4"),
  472. Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  473. .Annotation("MySql:CharSet", "utf8mb4")
  474. },
  475. constraints: table =>
  476. {
  477. table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key, x.Value });
  478. table.ForeignKey(
  479. name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId",
  480. column: x => x.ClientId,
  481. principalTable: "IdentityServerClients",
  482. principalColumn: "Id",
  483. onDelete: ReferentialAction.Cascade);
  484. })
  485. .Annotation("MySql:CharSet", "utf8mb4");
  486. migrationBuilder.CreateTable(
  487. name: "IdentityServerClientRedirectUris",
  488. columns: table => new
  489. {
  490. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  491. RedirectUri = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  492. .Annotation("MySql:CharSet", "utf8mb4")
  493. },
  494. constraints: table =>
  495. {
  496. table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri });
  497. table.ForeignKey(
  498. name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_Clien~",
  499. column: x => x.ClientId,
  500. principalTable: "IdentityServerClients",
  501. principalColumn: "Id",
  502. onDelete: ReferentialAction.Cascade);
  503. })
  504. .Annotation("MySql:CharSet", "utf8mb4");
  505. migrationBuilder.CreateTable(
  506. name: "IdentityServerClientScopes",
  507. columns: table => new
  508. {
  509. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  510. Scope = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  511. .Annotation("MySql:CharSet", "utf8mb4")
  512. },
  513. constraints: table =>
  514. {
  515. table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope });
  516. table.ForeignKey(
  517. name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId",
  518. column: x => x.ClientId,
  519. principalTable: "IdentityServerClients",
  520. principalColumn: "Id",
  521. onDelete: ReferentialAction.Cascade);
  522. })
  523. .Annotation("MySql:CharSet", "utf8mb4");
  524. migrationBuilder.CreateTable(
  525. name: "IdentityServerClientSecrets",
  526. columns: table => new
  527. {
  528. Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  529. .Annotation("MySql:CharSet", "utf8mb4"),
  530. Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  531. .Annotation("MySql:CharSet", "utf8mb4"),
  532. ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  533. Description = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
  534. .Annotation("MySql:CharSet", "utf8mb4"),
  535. Expiration = table.Column<DateTime>(type: "datetime", nullable: true)
  536. },
  537. constraints: table =>
  538. {
  539. table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value });
  540. table.ForeignKey(
  541. name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId",
  542. column: x => x.ClientId,
  543. principalTable: "IdentityServerClients",
  544. principalColumn: "Id",
  545. onDelete: ReferentialAction.Cascade);
  546. })
  547. .Annotation("MySql:CharSet", "utf8mb4");
  548. migrationBuilder.CreateTable(
  549. name: "IdentityServerIdentityResourceClaims",
  550. columns: table => new
  551. {
  552. Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
  553. .Annotation("MySql:CharSet", "utf8mb4"),
  554. IdentityResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
  555. },
  556. constraints: table =>
  557. {
  558. table.PrimaryKey("PK_IdentityServerIdentityResourceClaims", x => new { x.IdentityResourceId, x.Type });
  559. table.ForeignKey(
  560. name: "FK_IdentityServerIdentityResourceClaims_IdentityServerIdentityR~",
  561. column: x => x.IdentityResourceId,
  562. principalTable: "IdentityServerIdentityResources",
  563. principalColumn: "Id",
  564. onDelete: ReferentialAction.Cascade);
  565. })
  566. .Annotation("MySql:CharSet", "utf8mb4");
  567. migrationBuilder.CreateTable(
  568. name: "IdentityServerIdentityResourceProperties",
  569. columns: table => new
  570. {
  571. IdentityResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
  572. Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
  573. .Annotation("MySql:CharSet", "utf8mb4"),
  574. Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false)
  575. .Annotation("MySql:CharSet", "utf8mb4")
  576. },
  577. constraints: table =>
  578. {
  579. table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key, x.Value });
  580. table.ForeignKey(
  581. name: "FK_IdentityServerIdentityResourceProperties_IdentityServerIdent~",
  582. column: x => x.IdentityResourceId,
  583. principalTable: "IdentityServerIdentityResources",
  584. principalColumn: "Id",
  585. onDelete: ReferentialAction.Cascade);
  586. })
  587. .Annotation("MySql:CharSet", "utf8mb4");
  588. migrationBuilder.CreateIndex(
  589. name: "IX_IdentityServerClients_ClientId",
  590. table: "IdentityServerClients",
  591. column: "ClientId");
  592. migrationBuilder.CreateIndex(
  593. name: "IX_IdentityServerDeviceFlowCodes_DeviceCode",
  594. table: "IdentityServerDeviceFlowCodes",
  595. column: "DeviceCode",
  596. unique: true);
  597. migrationBuilder.CreateIndex(
  598. name: "IX_IdentityServerDeviceFlowCodes_Expiration",
  599. table: "IdentityServerDeviceFlowCodes",
  600. column: "Expiration");
  601. migrationBuilder.CreateIndex(
  602. name: "IX_IdentityServerDeviceFlowCodes_UserCode",
  603. table: "IdentityServerDeviceFlowCodes",
  604. column: "UserCode");
  605. migrationBuilder.CreateIndex(
  606. name: "IX_IdentityServerPersistedGrants_Expiration",
  607. table: "IdentityServerPersistedGrants",
  608. column: "Expiration");
  609. migrationBuilder.CreateIndex(
  610. name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type",
  611. table: "IdentityServerPersistedGrants",
  612. columns: new[] { "SubjectId", "ClientId", "Type" });
  613. migrationBuilder.CreateIndex(
  614. name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type",
  615. table: "IdentityServerPersistedGrants",
  616. columns: new[] { "SubjectId", "SessionId", "Type" });
  617. }
  618. protected override void Down(MigrationBuilder migrationBuilder)
  619. {
  620. migrationBuilder.DropTable(
  621. name: "IdentityServerApiResourceClaims");
  622. migrationBuilder.DropTable(
  623. name: "IdentityServerApiResourceProperties");
  624. migrationBuilder.DropTable(
  625. name: "IdentityServerApiResourceScopes");
  626. migrationBuilder.DropTable(
  627. name: "IdentityServerApiResourceSecrets");
  628. migrationBuilder.DropTable(
  629. name: "IdentityServerApiScopeClaims");
  630. migrationBuilder.DropTable(
  631. name: "IdentityServerApiScopeProperties");
  632. migrationBuilder.DropTable(
  633. name: "IdentityServerClientClaims");
  634. migrationBuilder.DropTable(
  635. name: "IdentityServerClientCorsOrigins");
  636. migrationBuilder.DropTable(
  637. name: "IdentityServerClientGrantTypes");
  638. migrationBuilder.DropTable(
  639. name: "IdentityServerClientIdPRestrictions");
  640. migrationBuilder.DropTable(
  641. name: "IdentityServerClientPostLogoutRedirectUris");
  642. migrationBuilder.DropTable(
  643. name: "IdentityServerClientProperties");
  644. migrationBuilder.DropTable(
  645. name: "IdentityServerClientRedirectUris");
  646. migrationBuilder.DropTable(
  647. name: "IdentityServerClientScopes");
  648. migrationBuilder.DropTable(
  649. name: "IdentityServerClientSecrets");
  650. migrationBuilder.DropTable(
  651. name: "IdentityServerDeviceFlowCodes");
  652. migrationBuilder.DropTable(
  653. name: "IdentityServerIdentityResourceClaims");
  654. migrationBuilder.DropTable(
  655. name: "IdentityServerIdentityResourceProperties");
  656. migrationBuilder.DropTable(
  657. name: "IdentityServerPersistedGrants");
  658. migrationBuilder.DropTable(
  659. name: "IdentityServerApiResources");
  660. migrationBuilder.DropTable(
  661. name: "IdentityServerApiScopes");
  662. migrationBuilder.DropTable(
  663. name: "IdentityServerClients");
  664. migrationBuilder.DropTable(
  665. name: "IdentityServerIdentityResources");
  666. }
  667. }
  668. }