临河任务调度
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1132 行
61KB

  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Himp.TaskScheduling.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class Initial : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "AbpAuditLogs",
  14. columns: table => new
  15. {
  16. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  17. ApplicationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
  18. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  19. UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  20. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  21. TenantName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  22. ImpersonatorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  23. ImpersonatorUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  24. ImpersonatorTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  25. ImpersonatorTenantName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  26. ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  27. ExecutionDuration = table.Column<int>(type: "int", nullable: false),
  28. ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  29. ClientName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  30. ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  31. CorrelationId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  32. BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  33. HttpMethod = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
  34. Url = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  35. Exceptions = table.Column<string>(type: "nvarchar(max)", nullable: true),
  36. Comments = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  37. HttpStatusCode = table.Column<int>(type: "int", nullable: true),
  38. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  39. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false)
  40. },
  41. constraints: table =>
  42. {
  43. table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
  44. });
  45. migrationBuilder.CreateTable(
  46. name: "AbpClaimTypes",
  47. columns: table => new
  48. {
  49. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  50. Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  51. Required = table.Column<bool>(type: "bit", nullable: false),
  52. IsStatic = table.Column<bool>(type: "bit", nullable: false),
  53. Regex = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  54. RegexDescription = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  55. Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  56. ValueType = table.Column<int>(type: "int", nullable: false),
  57. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  58. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false)
  59. },
  60. constraints: table =>
  61. {
  62. table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
  63. });
  64. migrationBuilder.CreateTable(
  65. name: "AbpFeatureGroups",
  66. columns: table => new
  67. {
  68. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  69. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  70. DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  71. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  72. },
  73. constraints: table =>
  74. {
  75. table.PrimaryKey("PK_AbpFeatureGroups", x => x.Id);
  76. });
  77. migrationBuilder.CreateTable(
  78. name: "AbpFeatures",
  79. columns: table => new
  80. {
  81. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  82. GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  83. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  84. ParentName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  85. DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  86. Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  87. DefaultValue = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  88. IsVisibleToClients = table.Column<bool>(type: "bit", nullable: false),
  89. IsAvailableToHost = table.Column<bool>(type: "bit", nullable: false),
  90. AllowedProviders = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  91. ValueType = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
  92. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  93. },
  94. constraints: table =>
  95. {
  96. table.PrimaryKey("PK_AbpFeatures", x => x.Id);
  97. });
  98. migrationBuilder.CreateTable(
  99. name: "AbpFeatureValues",
  100. columns: table => new
  101. {
  102. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  103. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  104. Value = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  105. ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  106. ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true)
  107. },
  108. constraints: table =>
  109. {
  110. table.PrimaryKey("PK_AbpFeatureValues", x => x.Id);
  111. });
  112. migrationBuilder.CreateTable(
  113. name: "AbpLinkUsers",
  114. columns: table => new
  115. {
  116. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  117. SourceUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  118. SourceTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  119. TargetUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  120. TargetTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
  121. },
  122. constraints: table =>
  123. {
  124. table.PrimaryKey("PK_AbpLinkUsers", x => x.Id);
  125. });
  126. migrationBuilder.CreateTable(
  127. name: "AbpOrganizationUnits",
  128. columns: table => new
  129. {
  130. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  131. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  132. ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  133. Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
  134. DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  135. EntityVersion = table.Column<int>(type: "int", nullable: false),
  136. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  137. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  138. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  139. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  140. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  141. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  142. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  143. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  144. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  145. },
  146. constraints: table =>
  147. {
  148. table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id);
  149. table.ForeignKey(
  150. name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId",
  151. column: x => x.ParentId,
  152. principalTable: "AbpOrganizationUnits",
  153. principalColumn: "Id");
  154. });
  155. migrationBuilder.CreateTable(
  156. name: "AbpPermissionGrants",
  157. columns: table => new
  158. {
  159. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  160. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  161. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  162. ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  163. ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
  164. },
  165. constraints: table =>
  166. {
  167. table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
  168. });
  169. migrationBuilder.CreateTable(
  170. name: "AbpPermissionGroups",
  171. columns: table => new
  172. {
  173. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  174. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  175. DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  176. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  177. },
  178. constraints: table =>
  179. {
  180. table.PrimaryKey("PK_AbpPermissionGroups", x => x.Id);
  181. });
  182. migrationBuilder.CreateTable(
  183. name: "AbpPermissions",
  184. columns: table => new
  185. {
  186. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  187. GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  188. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  189. ParentName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  190. DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  191. IsEnabled = table.Column<bool>(type: "bit", nullable: false),
  192. MultiTenancySide = table.Column<byte>(type: "tinyint", nullable: false),
  193. Providers = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  194. StateCheckers = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  195. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  196. },
  197. constraints: table =>
  198. {
  199. table.PrimaryKey("PK_AbpPermissions", x => x.Id);
  200. });
  201. migrationBuilder.CreateTable(
  202. name: "AbpRoles",
  203. columns: table => new
  204. {
  205. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  206. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  207. Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  208. NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  209. IsDefault = table.Column<bool>(type: "bit", nullable: false),
  210. IsStatic = table.Column<bool>(type: "bit", nullable: false),
  211. IsPublic = table.Column<bool>(type: "bit", nullable: false),
  212. EntityVersion = table.Column<int>(type: "int", nullable: false),
  213. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  214. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false)
  215. },
  216. constraints: table =>
  217. {
  218. table.PrimaryKey("PK_AbpRoles", x => x.Id);
  219. });
  220. migrationBuilder.CreateTable(
  221. name: "AbpSecurityLogs",
  222. columns: table => new
  223. {
  224. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  225. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  226. ApplicationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
  227. Identity = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
  228. Action = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
  229. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  230. UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  231. TenantName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  232. ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  233. CorrelationId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  234. ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  235. BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  236. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  237. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  238. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false)
  239. },
  240. constraints: table =>
  241. {
  242. table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id);
  243. });
  244. migrationBuilder.CreateTable(
  245. name: "AbpSessions",
  246. columns: table => new
  247. {
  248. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  249. SessionId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  250. Device = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  251. DeviceInfo = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  252. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  253. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  254. ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  255. IpAddresses = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  256. SignedIn = table.Column<DateTime>(type: "datetime2", nullable: false),
  257. LastAccessed = table.Column<DateTime>(type: "datetime2", nullable: true)
  258. },
  259. constraints: table =>
  260. {
  261. table.PrimaryKey("PK_AbpSessions", x => x.Id);
  262. });
  263. migrationBuilder.CreateTable(
  264. name: "AbpSettingDefinitions",
  265. columns: table => new
  266. {
  267. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  268. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  269. DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  270. Description = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  271. DefaultValue = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
  272. IsVisibleToClients = table.Column<bool>(type: "bit", nullable: false),
  273. Providers = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
  274. IsInherited = table.Column<bool>(type: "bit", nullable: false),
  275. IsEncrypted = table.Column<bool>(type: "bit", nullable: false),
  276. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  277. },
  278. constraints: table =>
  279. {
  280. table.PrimaryKey("PK_AbpSettingDefinitions", x => x.Id);
  281. });
  282. migrationBuilder.CreateTable(
  283. name: "AbpSettings",
  284. columns: table => new
  285. {
  286. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  287. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  288. Value = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: false),
  289. ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  290. ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true)
  291. },
  292. constraints: table =>
  293. {
  294. table.PrimaryKey("PK_AbpSettings", x => x.Id);
  295. });
  296. migrationBuilder.CreateTable(
  297. name: "AbpTenants",
  298. columns: table => new
  299. {
  300. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  301. Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  302. NormalizedName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  303. EntityVersion = table.Column<int>(type: "int", nullable: false),
  304. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  305. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  306. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  307. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  308. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  309. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  310. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  311. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  312. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  313. },
  314. constraints: table =>
  315. {
  316. table.PrimaryKey("PK_AbpTenants", x => x.Id);
  317. });
  318. migrationBuilder.CreateTable(
  319. name: "AbpUserDelegations",
  320. columns: table => new
  321. {
  322. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  323. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  324. SourceUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  325. TargetUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  326. StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  327. EndTime = table.Column<DateTime>(type: "datetime2", nullable: false)
  328. },
  329. constraints: table =>
  330. {
  331. table.PrimaryKey("PK_AbpUserDelegations", x => x.Id);
  332. });
  333. migrationBuilder.CreateTable(
  334. name: "AbpUsers",
  335. columns: table => new
  336. {
  337. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  338. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  339. UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  340. NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  341. Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  342. Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
  343. Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  344. NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  345. EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  346. PasswordHash = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  347. SecurityStamp = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  348. IsExternal = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  349. PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
  350. PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  351. IsActive = table.Column<bool>(type: "bit", nullable: false),
  352. TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  353. LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
  354. LockoutEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  355. AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
  356. ShouldChangePasswordOnNextLogin = table.Column<bool>(type: "bit", nullable: false),
  357. EntityVersion = table.Column<int>(type: "int", nullable: false),
  358. LastPasswordChangeTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
  359. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  360. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  361. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  362. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  363. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  364. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  365. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  366. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  367. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  368. },
  369. constraints: table =>
  370. {
  371. table.PrimaryKey("PK_AbpUsers", x => x.Id);
  372. });
  373. migrationBuilder.CreateTable(
  374. name: "OpenIddictApplications",
  375. columns: table => new
  376. {
  377. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  378. ApplicationType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  379. ClientId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  380. ClientSecret = table.Column<string>(type: "nvarchar(max)", nullable: true),
  381. ClientType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  382. ConsentType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  383. DisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  384. DisplayNames = table.Column<string>(type: "nvarchar(max)", nullable: true),
  385. JsonWebKeySet = table.Column<string>(type: "nvarchar(max)", nullable: true),
  386. Permissions = table.Column<string>(type: "nvarchar(max)", nullable: true),
  387. PostLogoutRedirectUris = table.Column<string>(type: "nvarchar(max)", nullable: true),
  388. Properties = table.Column<string>(type: "nvarchar(max)", nullable: true),
  389. RedirectUris = table.Column<string>(type: "nvarchar(max)", nullable: true),
  390. Requirements = table.Column<string>(type: "nvarchar(max)", nullable: true),
  391. Settings = table.Column<string>(type: "nvarchar(max)", nullable: true),
  392. ClientUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
  393. LogoUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
  394. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  395. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  396. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  397. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  398. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  399. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  400. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  401. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  402. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  403. },
  404. constraints: table =>
  405. {
  406. table.PrimaryKey("PK_OpenIddictApplications", x => x.Id);
  407. });
  408. migrationBuilder.CreateTable(
  409. name: "OpenIddictScopes",
  410. columns: table => new
  411. {
  412. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  413. Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
  414. Descriptions = table.Column<string>(type: "nvarchar(max)", nullable: true),
  415. DisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  416. DisplayNames = table.Column<string>(type: "nvarchar(max)", nullable: true),
  417. Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
  418. Properties = table.Column<string>(type: "nvarchar(max)", nullable: true),
  419. Resources = table.Column<string>(type: "nvarchar(max)", nullable: true),
  420. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  421. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  422. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  423. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  424. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  425. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  426. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  427. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  428. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  429. },
  430. constraints: table =>
  431. {
  432. table.PrimaryKey("PK_OpenIddictScopes", x => x.Id);
  433. });
  434. migrationBuilder.CreateTable(
  435. name: "AbpAuditLogActions",
  436. columns: table => new
  437. {
  438. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  439. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  440. AuditLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  441. ServiceName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  442. MethodName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  443. Parameters = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
  444. ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  445. ExecutionDuration = table.Column<int>(type: "int", nullable: false),
  446. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  447. },
  448. constraints: table =>
  449. {
  450. table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id);
  451. table.ForeignKey(
  452. name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId",
  453. column: x => x.AuditLogId,
  454. principalTable: "AbpAuditLogs",
  455. principalColumn: "Id",
  456. onDelete: ReferentialAction.Cascade);
  457. });
  458. migrationBuilder.CreateTable(
  459. name: "AbpEntityChanges",
  460. columns: table => new
  461. {
  462. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  463. AuditLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  464. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  465. ChangeTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  466. ChangeType = table.Column<byte>(type: "tinyint", nullable: false),
  467. EntityTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  468. EntityId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
  469. EntityTypeFullName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  470. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
  471. },
  472. constraints: table =>
  473. {
  474. table.PrimaryKey("PK_AbpEntityChanges", x => x.Id);
  475. table.ForeignKey(
  476. name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId",
  477. column: x => x.AuditLogId,
  478. principalTable: "AbpAuditLogs",
  479. principalColumn: "Id",
  480. onDelete: ReferentialAction.Cascade);
  481. });
  482. migrationBuilder.CreateTable(
  483. name: "AbpOrganizationUnitRoles",
  484. columns: table => new
  485. {
  486. RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  487. OrganizationUnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  488. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  489. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  490. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
  491. },
  492. constraints: table =>
  493. {
  494. table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId });
  495. table.ForeignKey(
  496. name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId",
  497. column: x => x.OrganizationUnitId,
  498. principalTable: "AbpOrganizationUnits",
  499. principalColumn: "Id",
  500. onDelete: ReferentialAction.Cascade);
  501. table.ForeignKey(
  502. name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId",
  503. column: x => x.RoleId,
  504. principalTable: "AbpRoles",
  505. principalColumn: "Id",
  506. onDelete: ReferentialAction.Cascade);
  507. });
  508. migrationBuilder.CreateTable(
  509. name: "AbpRoleClaims",
  510. columns: table => new
  511. {
  512. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  513. RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  514. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  515. ClaimType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  516. ClaimValue = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true)
  517. },
  518. constraints: table =>
  519. {
  520. table.PrimaryKey("PK_AbpRoleClaims", x => x.Id);
  521. table.ForeignKey(
  522. name: "FK_AbpRoleClaims_AbpRoles_RoleId",
  523. column: x => x.RoleId,
  524. principalTable: "AbpRoles",
  525. principalColumn: "Id",
  526. onDelete: ReferentialAction.Cascade);
  527. });
  528. migrationBuilder.CreateTable(
  529. name: "AbpTenantConnectionStrings",
  530. columns: table => new
  531. {
  532. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  533. Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  534. Value = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false)
  535. },
  536. constraints: table =>
  537. {
  538. table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name });
  539. table.ForeignKey(
  540. name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId",
  541. column: x => x.TenantId,
  542. principalTable: "AbpTenants",
  543. principalColumn: "Id",
  544. onDelete: ReferentialAction.Cascade);
  545. });
  546. migrationBuilder.CreateTable(
  547. name: "AbpUserClaims",
  548. columns: table => new
  549. {
  550. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  551. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  552. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  553. ClaimType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
  554. ClaimValue = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true)
  555. },
  556. constraints: table =>
  557. {
  558. table.PrimaryKey("PK_AbpUserClaims", x => x.Id);
  559. table.ForeignKey(
  560. name: "FK_AbpUserClaims_AbpUsers_UserId",
  561. column: x => x.UserId,
  562. principalTable: "AbpUsers",
  563. principalColumn: "Id",
  564. onDelete: ReferentialAction.Cascade);
  565. });
  566. migrationBuilder.CreateTable(
  567. name: "AbpUserLogins",
  568. columns: table => new
  569. {
  570. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  571. LoginProvider = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  572. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  573. ProviderKey = table.Column<string>(type: "nvarchar(196)", maxLength: 196, nullable: false),
  574. ProviderDisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true)
  575. },
  576. constraints: table =>
  577. {
  578. table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider });
  579. table.ForeignKey(
  580. name: "FK_AbpUserLogins_AbpUsers_UserId",
  581. column: x => x.UserId,
  582. principalTable: "AbpUsers",
  583. principalColumn: "Id",
  584. onDelete: ReferentialAction.Cascade);
  585. });
  586. migrationBuilder.CreateTable(
  587. name: "AbpUserOrganizationUnits",
  588. columns: table => new
  589. {
  590. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  591. OrganizationUnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  592. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  593. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  594. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
  595. },
  596. constraints: table =>
  597. {
  598. table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId });
  599. table.ForeignKey(
  600. name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId",
  601. column: x => x.OrganizationUnitId,
  602. principalTable: "AbpOrganizationUnits",
  603. principalColumn: "Id",
  604. onDelete: ReferentialAction.Cascade);
  605. table.ForeignKey(
  606. name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId",
  607. column: x => x.UserId,
  608. principalTable: "AbpUsers",
  609. principalColumn: "Id",
  610. onDelete: ReferentialAction.Cascade);
  611. });
  612. migrationBuilder.CreateTable(
  613. name: "AbpUserRoles",
  614. columns: table => new
  615. {
  616. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  617. RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  618. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
  619. },
  620. constraints: table =>
  621. {
  622. table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId });
  623. table.ForeignKey(
  624. name: "FK_AbpUserRoles_AbpRoles_RoleId",
  625. column: x => x.RoleId,
  626. principalTable: "AbpRoles",
  627. principalColumn: "Id",
  628. onDelete: ReferentialAction.Cascade);
  629. table.ForeignKey(
  630. name: "FK_AbpUserRoles_AbpUsers_UserId",
  631. column: x => x.UserId,
  632. principalTable: "AbpUsers",
  633. principalColumn: "Id",
  634. onDelete: ReferentialAction.Cascade);
  635. });
  636. migrationBuilder.CreateTable(
  637. name: "AbpUserTokens",
  638. columns: table => new
  639. {
  640. UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  641. LoginProvider = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
  642. Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  643. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  644. Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
  645. },
  646. constraints: table =>
  647. {
  648. table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
  649. table.ForeignKey(
  650. name: "FK_AbpUserTokens_AbpUsers_UserId",
  651. column: x => x.UserId,
  652. principalTable: "AbpUsers",
  653. principalColumn: "Id",
  654. onDelete: ReferentialAction.Cascade);
  655. });
  656. migrationBuilder.CreateTable(
  657. name: "OpenIddictAuthorizations",
  658. columns: table => new
  659. {
  660. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  661. ApplicationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  662. CreationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  663. Properties = table.Column<string>(type: "nvarchar(max)", nullable: true),
  664. Scopes = table.Column<string>(type: "nvarchar(max)", nullable: true),
  665. Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  666. Subject = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true),
  667. Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  668. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  669. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  670. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  671. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  672. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  673. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  674. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  675. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  676. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  677. },
  678. constraints: table =>
  679. {
  680. table.PrimaryKey("PK_OpenIddictAuthorizations", x => x.Id);
  681. table.ForeignKey(
  682. name: "FK_OpenIddictAuthorizations_OpenIddictApplications_ApplicationId",
  683. column: x => x.ApplicationId,
  684. principalTable: "OpenIddictApplications",
  685. principalColumn: "Id");
  686. });
  687. migrationBuilder.CreateTable(
  688. name: "AbpEntityPropertyChanges",
  689. columns: table => new
  690. {
  691. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  692. TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  693. EntityChangeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  694. NewValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  695. OriginalValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  696. PropertyName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
  697. PropertyTypeFullName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
  698. },
  699. constraints: table =>
  700. {
  701. table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id);
  702. table.ForeignKey(
  703. name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId",
  704. column: x => x.EntityChangeId,
  705. principalTable: "AbpEntityChanges",
  706. principalColumn: "Id",
  707. onDelete: ReferentialAction.Cascade);
  708. });
  709. migrationBuilder.CreateTable(
  710. name: "OpenIddictTokens",
  711. columns: table => new
  712. {
  713. Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
  714. ApplicationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  715. AuthorizationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  716. CreationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  717. ExpirationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  718. Payload = table.Column<string>(type: "nvarchar(max)", nullable: true),
  719. Properties = table.Column<string>(type: "nvarchar(max)", nullable: true),
  720. RedemptionDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  721. ReferenceId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
  722. Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  723. Subject = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true),
  724. Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
  725. ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
  726. ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
  727. CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
  728. CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  729. LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
  730. LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  731. IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
  732. DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
  733. DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
  734. },
  735. constraints: table =>
  736. {
  737. table.PrimaryKey("PK_OpenIddictTokens", x => x.Id);
  738. table.ForeignKey(
  739. name: "FK_OpenIddictTokens_OpenIddictApplications_ApplicationId",
  740. column: x => x.ApplicationId,
  741. principalTable: "OpenIddictApplications",
  742. principalColumn: "Id");
  743. table.ForeignKey(
  744. name: "FK_OpenIddictTokens_OpenIddictAuthorizations_AuthorizationId",
  745. column: x => x.AuthorizationId,
  746. principalTable: "OpenIddictAuthorizations",
  747. principalColumn: "Id");
  748. });
  749. migrationBuilder.CreateIndex(
  750. name: "IX_AbpAuditLogActions_AuditLogId",
  751. table: "AbpAuditLogActions",
  752. column: "AuditLogId");
  753. migrationBuilder.CreateIndex(
  754. name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime",
  755. table: "AbpAuditLogActions",
  756. columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" });
  757. migrationBuilder.CreateIndex(
  758. name: "IX_AbpAuditLogs_TenantId_ExecutionTime",
  759. table: "AbpAuditLogs",
  760. columns: new[] { "TenantId", "ExecutionTime" });
  761. migrationBuilder.CreateIndex(
  762. name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime",
  763. table: "AbpAuditLogs",
  764. columns: new[] { "TenantId", "UserId", "ExecutionTime" });
  765. migrationBuilder.CreateIndex(
  766. name: "IX_AbpEntityChanges_AuditLogId",
  767. table: "AbpEntityChanges",
  768. column: "AuditLogId");
  769. migrationBuilder.CreateIndex(
  770. name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId",
  771. table: "AbpEntityChanges",
  772. columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" });
  773. migrationBuilder.CreateIndex(
  774. name: "IX_AbpEntityPropertyChanges_EntityChangeId",
  775. table: "AbpEntityPropertyChanges",
  776. column: "EntityChangeId");
  777. migrationBuilder.CreateIndex(
  778. name: "IX_AbpFeatureGroups_Name",
  779. table: "AbpFeatureGroups",
  780. column: "Name",
  781. unique: true);
  782. migrationBuilder.CreateIndex(
  783. name: "IX_AbpFeatures_GroupName",
  784. table: "AbpFeatures",
  785. column: "GroupName");
  786. migrationBuilder.CreateIndex(
  787. name: "IX_AbpFeatures_Name",
  788. table: "AbpFeatures",
  789. column: "Name",
  790. unique: true);
  791. migrationBuilder.CreateIndex(
  792. name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey",
  793. table: "AbpFeatureValues",
  794. columns: new[] { "Name", "ProviderName", "ProviderKey" },
  795. unique: true,
  796. filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL");
  797. migrationBuilder.CreateIndex(
  798. name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId",
  799. table: "AbpLinkUsers",
  800. columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" },
  801. unique: true,
  802. filter: "[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL");
  803. migrationBuilder.CreateIndex(
  804. name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId",
  805. table: "AbpOrganizationUnitRoles",
  806. columns: new[] { "RoleId", "OrganizationUnitId" });
  807. migrationBuilder.CreateIndex(
  808. name: "IX_AbpOrganizationUnits_Code",
  809. table: "AbpOrganizationUnits",
  810. column: "Code");
  811. migrationBuilder.CreateIndex(
  812. name: "IX_AbpOrganizationUnits_ParentId",
  813. table: "AbpOrganizationUnits",
  814. column: "ParentId");
  815. migrationBuilder.CreateIndex(
  816. name: "IX_AbpPermissionGrants_TenantId_Name_ProviderName_ProviderKey",
  817. table: "AbpPermissionGrants",
  818. columns: new[] { "TenantId", "Name", "ProviderName", "ProviderKey" },
  819. unique: true,
  820. filter: "[TenantId] IS NOT NULL");
  821. migrationBuilder.CreateIndex(
  822. name: "IX_AbpPermissionGroups_Name",
  823. table: "AbpPermissionGroups",
  824. column: "Name",
  825. unique: true);
  826. migrationBuilder.CreateIndex(
  827. name: "IX_AbpPermissions_GroupName",
  828. table: "AbpPermissions",
  829. column: "GroupName");
  830. migrationBuilder.CreateIndex(
  831. name: "IX_AbpPermissions_Name",
  832. table: "AbpPermissions",
  833. column: "Name",
  834. unique: true);
  835. migrationBuilder.CreateIndex(
  836. name: "IX_AbpRoleClaims_RoleId",
  837. table: "AbpRoleClaims",
  838. column: "RoleId");
  839. migrationBuilder.CreateIndex(
  840. name: "IX_AbpRoles_NormalizedName",
  841. table: "AbpRoles",
  842. column: "NormalizedName");
  843. migrationBuilder.CreateIndex(
  844. name: "IX_AbpSecurityLogs_TenantId_Action",
  845. table: "AbpSecurityLogs",
  846. columns: new[] { "TenantId", "Action" });
  847. migrationBuilder.CreateIndex(
  848. name: "IX_AbpSecurityLogs_TenantId_ApplicationName",
  849. table: "AbpSecurityLogs",
  850. columns: new[] { "TenantId", "ApplicationName" });
  851. migrationBuilder.CreateIndex(
  852. name: "IX_AbpSecurityLogs_TenantId_Identity",
  853. table: "AbpSecurityLogs",
  854. columns: new[] { "TenantId", "Identity" });
  855. migrationBuilder.CreateIndex(
  856. name: "IX_AbpSecurityLogs_TenantId_UserId",
  857. table: "AbpSecurityLogs",
  858. columns: new[] { "TenantId", "UserId" });
  859. migrationBuilder.CreateIndex(
  860. name: "IX_AbpSessions_Device",
  861. table: "AbpSessions",
  862. column: "Device");
  863. migrationBuilder.CreateIndex(
  864. name: "IX_AbpSessions_SessionId",
  865. table: "AbpSessions",
  866. column: "SessionId");
  867. migrationBuilder.CreateIndex(
  868. name: "IX_AbpSessions_TenantId_UserId",
  869. table: "AbpSessions",
  870. columns: new[] { "TenantId", "UserId" });
  871. migrationBuilder.CreateIndex(
  872. name: "IX_AbpSettingDefinitions_Name",
  873. table: "AbpSettingDefinitions",
  874. column: "Name",
  875. unique: true);
  876. migrationBuilder.CreateIndex(
  877. name: "IX_AbpSettings_Name_ProviderName_ProviderKey",
  878. table: "AbpSettings",
  879. columns: new[] { "Name", "ProviderName", "ProviderKey" },
  880. unique: true,
  881. filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL");
  882. migrationBuilder.CreateIndex(
  883. name: "IX_AbpTenants_Name",
  884. table: "AbpTenants",
  885. column: "Name");
  886. migrationBuilder.CreateIndex(
  887. name: "IX_AbpTenants_NormalizedName",
  888. table: "AbpTenants",
  889. column: "NormalizedName");
  890. migrationBuilder.CreateIndex(
  891. name: "IX_AbpUserClaims_UserId",
  892. table: "AbpUserClaims",
  893. column: "UserId");
  894. migrationBuilder.CreateIndex(
  895. name: "IX_AbpUserLogins_LoginProvider_ProviderKey",
  896. table: "AbpUserLogins",
  897. columns: new[] { "LoginProvider", "ProviderKey" });
  898. migrationBuilder.CreateIndex(
  899. name: "IX_AbpUserOrganizationUnits_UserId_OrganizationUnitId",
  900. table: "AbpUserOrganizationUnits",
  901. columns: new[] { "UserId", "OrganizationUnitId" });
  902. migrationBuilder.CreateIndex(
  903. name: "IX_AbpUserRoles_RoleId_UserId",
  904. table: "AbpUserRoles",
  905. columns: new[] { "RoleId", "UserId" });
  906. migrationBuilder.CreateIndex(
  907. name: "IX_AbpUsers_Email",
  908. table: "AbpUsers",
  909. column: "Email");
  910. migrationBuilder.CreateIndex(
  911. name: "IX_AbpUsers_NormalizedEmail",
  912. table: "AbpUsers",
  913. column: "NormalizedEmail");
  914. migrationBuilder.CreateIndex(
  915. name: "IX_AbpUsers_NormalizedUserName",
  916. table: "AbpUsers",
  917. column: "NormalizedUserName");
  918. migrationBuilder.CreateIndex(
  919. name: "IX_AbpUsers_UserName",
  920. table: "AbpUsers",
  921. column: "UserName");
  922. migrationBuilder.CreateIndex(
  923. name: "IX_OpenIddictApplications_ClientId",
  924. table: "OpenIddictApplications",
  925. column: "ClientId");
  926. migrationBuilder.CreateIndex(
  927. name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
  928. table: "OpenIddictAuthorizations",
  929. columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
  930. migrationBuilder.CreateIndex(
  931. name: "IX_OpenIddictScopes_Name",
  932. table: "OpenIddictScopes",
  933. column: "Name");
  934. migrationBuilder.CreateIndex(
  935. name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type",
  936. table: "OpenIddictTokens",
  937. columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
  938. migrationBuilder.CreateIndex(
  939. name: "IX_OpenIddictTokens_AuthorizationId",
  940. table: "OpenIddictTokens",
  941. column: "AuthorizationId");
  942. migrationBuilder.CreateIndex(
  943. name: "IX_OpenIddictTokens_ReferenceId",
  944. table: "OpenIddictTokens",
  945. column: "ReferenceId");
  946. }
  947. /// <inheritdoc />
  948. protected override void Down(MigrationBuilder migrationBuilder)
  949. {
  950. migrationBuilder.DropTable(
  951. name: "AbpAuditLogActions");
  952. migrationBuilder.DropTable(
  953. name: "AbpClaimTypes");
  954. migrationBuilder.DropTable(
  955. name: "AbpEntityPropertyChanges");
  956. migrationBuilder.DropTable(
  957. name: "AbpFeatureGroups");
  958. migrationBuilder.DropTable(
  959. name: "AbpFeatures");
  960. migrationBuilder.DropTable(
  961. name: "AbpFeatureValues");
  962. migrationBuilder.DropTable(
  963. name: "AbpLinkUsers");
  964. migrationBuilder.DropTable(
  965. name: "AbpOrganizationUnitRoles");
  966. migrationBuilder.DropTable(
  967. name: "AbpPermissionGrants");
  968. migrationBuilder.DropTable(
  969. name: "AbpPermissionGroups");
  970. migrationBuilder.DropTable(
  971. name: "AbpPermissions");
  972. migrationBuilder.DropTable(
  973. name: "AbpRoleClaims");
  974. migrationBuilder.DropTable(
  975. name: "AbpSecurityLogs");
  976. migrationBuilder.DropTable(
  977. name: "AbpSessions");
  978. migrationBuilder.DropTable(
  979. name: "AbpSettingDefinitions");
  980. migrationBuilder.DropTable(
  981. name: "AbpSettings");
  982. migrationBuilder.DropTable(
  983. name: "AbpTenantConnectionStrings");
  984. migrationBuilder.DropTable(
  985. name: "AbpUserClaims");
  986. migrationBuilder.DropTable(
  987. name: "AbpUserDelegations");
  988. migrationBuilder.DropTable(
  989. name: "AbpUserLogins");
  990. migrationBuilder.DropTable(
  991. name: "AbpUserOrganizationUnits");
  992. migrationBuilder.DropTable(
  993. name: "AbpUserRoles");
  994. migrationBuilder.DropTable(
  995. name: "AbpUserTokens");
  996. migrationBuilder.DropTable(
  997. name: "OpenIddictScopes");
  998. migrationBuilder.DropTable(
  999. name: "OpenIddictTokens");
  1000. migrationBuilder.DropTable(
  1001. name: "AbpEntityChanges");
  1002. migrationBuilder.DropTable(
  1003. name: "AbpTenants");
  1004. migrationBuilder.DropTable(
  1005. name: "AbpOrganizationUnits");
  1006. migrationBuilder.DropTable(
  1007. name: "AbpRoles");
  1008. migrationBuilder.DropTable(
  1009. name: "AbpUsers");
  1010. migrationBuilder.DropTable(
  1011. name: "OpenIddictAuthorizations");
  1012. migrationBuilder.DropTable(
  1013. name: "AbpAuditLogs");
  1014. migrationBuilder.DropTable(
  1015. name: "OpenIddictApplications");
  1016. }
  1017. }
  1018. }