Advertisement
Guest User

Untitled

a guest
Jan 29th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.83 KB | None | 0 0
  1. #region Insert Data
  2.  
  3. #region Insert System Application
  4. migrationBuilder.InsertData(
  5. table: "Applications",
  6. columns: new[]
  7. {
  8. "Id",
  9. "Guid",
  10. "CreatedAt",
  11. "UpdatedAt",
  12. "Name",
  13. "Description"
  14. },
  15. values: new object[]
  16. {
  17. 1,
  18. Constants.ApplicationSystemGuid,
  19. new DateTime(2019, 01, 30),
  20. new DateTime(2019, 01, 30),
  21. "System",
  22. "This is a default application to manage users"
  23. }
  24. );
  25. migrationBuilder.InsertData(
  26. table: "Forms",
  27. columns: new[]
  28. {
  29. "Id",
  30. "Guid",
  31. "CreatedAt",
  32. "UpdatedAt",
  33. "Name",
  34. "ApplicationId"
  35. },
  36. values: new object[]
  37. {
  38. 1,
  39. Constants.FormUsersGuid,
  40. new DateTime(2019, 01, 30),
  41. new DateTime(2019, 01, 30),
  42. "Users",
  43. 1
  44. }
  45. );
  46. migrationBuilder.InsertData(
  47. table: "Forms",
  48. columns: new[]
  49. {
  50. "Id",
  51. "Guid",
  52. "CreatedAt",
  53. "UpdatedAt",
  54. "Name",
  55. "ApplicationId"
  56. },
  57. values: new object[]
  58. {
  59. 2,
  60. Constants.FormGroupsGuid,
  61. new DateTime(2019, 01, 30),
  62. new DateTime(2019, 01, 30),
  63. "Groups",
  64. 1
  65. }
  66. ); migrationBuilder.InsertData(
  67. table: "FormViews",
  68. columns: new[]
  69. {
  70. "Id",
  71. "CreatedAt",
  72. "UpdatedAt",
  73. "Name",
  74. "FormId"
  75. },
  76. values: new object[]
  77. {
  78. 1,
  79. new DateTime(2019, 01, 30),
  80. new DateTime(2019, 01, 30),
  81. "UsersView",
  82. 1
  83. }
  84. ); migrationBuilder.InsertData(
  85. table: "FormViews",
  86. columns: new[]
  87. {
  88. "Id",
  89. "CreatedAt",
  90. "UpdatedAt",
  91. "Name",
  92. "FormId"
  93. },
  94. values: new object[]
  95. {
  96. 2,
  97. new DateTime(2019, 01, 30),
  98. new DateTime(2019, 01, 30),
  99. "GroupsView",
  100. 2
  101. }
  102. );
  103. migrationBuilder.InsertData(
  104. table: "FormAttributes",
  105. columns: new[]
  106. {
  107. "Id",
  108. "CreatedAt",
  109. "UpdatedAt",
  110. "Guid",
  111. "Name",
  112. "FormId",
  113. "AttributeTypeId",
  114. "Column",
  115. "Code"
  116. },
  117. values: new object[]
  118. {
  119. 1,
  120. new DateTime(2019, 01, 30),
  121. new DateTime(2019, 01, 30),
  122. Constants.UserFirstNameGuid,
  123. "First Name",
  124. 1,
  125. 1,
  126. "Text1",
  127. "UserFirstName"
  128. }
  129. );
  130. migrationBuilder.InsertData(
  131. table: "FormAttributes",
  132. columns: new[]
  133. {
  134. "Id",
  135. "CreatedAt",
  136. "UpdatedAt",
  137. "Guid",
  138. "Name",
  139. "FormId",
  140. "AttributeTypeId",
  141. "Column",
  142. "Code"
  143. },
  144. values: new object[]
  145. {
  146. 2,
  147. new DateTime(2019, 01, 30),
  148. new DateTime(2019, 01, 30),
  149. Constants.UserLastNameGuid,
  150. "Last Name",
  151. 1,
  152. 1,
  153. "Text2",
  154. "UserLastName"
  155. }
  156. );
  157. migrationBuilder.InsertData(
  158. table: "FormAttributes",
  159. columns: new[]
  160. {
  161. "Id",
  162. "CreatedAt",
  163. "UpdatedAt",
  164. "Guid",
  165. "Name",
  166. "FormId",
  167. "AttributeTypeId",
  168. "Column",
  169. "Code"
  170. },
  171. values: new object[]
  172. {
  173. 3,
  174. new DateTime(2019, 01, 30),
  175. new DateTime(2019, 01, 30),
  176. Constants.GroupNameGuid,
  177. "Name",
  178. 2,
  179. 1,
  180. "Text1",
  181. "GroupName"
  182. }
  183. );
  184. migrationBuilder.InsertData(
  185. table: "Fields",
  186. columns: new[]
  187. {
  188. "Id",
  189. "CreatedAt",
  190. "UpdatedAt",
  191. "FormViewId",
  192. "PlaceholderId",
  193. "FieldPosition",
  194. "IsRequired",
  195. "IsEditable",
  196. "IsVisible",
  197. "FormAttributeId"
  198. },
  199. values: new object[]
  200. {
  201. 1,
  202. new DateTime(2019, 01, 30),
  203. new DateTime(2019, 01, 30),
  204. 1,
  205. 0,
  206. 0,
  207. true,
  208. true,
  209. true,
  210. 1
  211. }
  212. );
  213. migrationBuilder.InsertData(
  214. table: "Fields",
  215. columns: new[]
  216. {
  217. "Id",
  218. "CreatedAt",
  219. "UpdatedAt",
  220. "FormViewId",
  221. "PlaceholderId",
  222. "FieldPosition",
  223. "IsRequired",
  224. "IsEditable",
  225. "IsVisible",
  226. "FormAttributeId"
  227. },
  228. values: new object[]
  229. {
  230. 2,
  231. new DateTime(2019, 01, 30),
  232. new DateTime(2019, 01, 30),
  233. 1,
  234. 0,
  235. 1,
  236. true,
  237. true,
  238. true,
  239. 2
  240. }
  241. );
  242. migrationBuilder.InsertData(
  243. table: "Fields",
  244. columns: new[]
  245. {
  246. "Id",
  247. "CreatedAt",
  248. "UpdatedAt",
  249. "FormViewId",
  250. "PlaceholderId",
  251. "FieldPosition",
  252. "IsRequired",
  253. "IsEditable",
  254. "IsVisible",
  255. "FormAttributeId"
  256. },
  257. values: new object[]
  258. {
  259. 3,
  260. new DateTime(2019, 01, 30),
  261. new DateTime(2019, 01, 30),
  262. 2,
  263. 0,
  264. 0,
  265. true,
  266. true,
  267. true,
  268. 3
  269. }
  270. );
  271. migrationBuilder.InsertData(
  272. table: "Signatures",
  273. columns: new[] { "Id", "CreatedAt", "UpdatedAt", "FormId" },
  274. values: new object[] { "1", new DateTime(2019, 01, 30), new DateTime(2019, 01, 30), 1 }
  275. );
  276. migrationBuilder.InsertData(
  277. table: "Signatures",
  278. columns: new[] { "Id", "CreatedAt", "UpdatedAt", "FormId" },
  279. values: new object[] { "2", new DateTime(2019, 01, 30), new DateTime(2019, 01, 30), 2 }
  280. );
  281. #endregion
  282.  
  283. #region Insert Users
  284. migrationBuilder.InsertData(
  285. table: "Documents",
  286. columns: new[] { "Id", "CreatedAt", "UpdatedAt", "FormId", "Text1", "Text2" },
  287. values: new object[] { 1, new DateTime(2019, 01, 30), new DateTime(2019, 01, 30), 1, "Admin First Name", "Admin Surname" }
  288. );
  289. //username: admin
  290. //password: admin
  291. migrationBuilder.InsertData(
  292. table: "AspNetUsers",
  293. columns: new[]
  294. {
  295. "Id",
  296. "DocumentId",
  297. "UserName",
  298. "NormalizedUserName",
  299. "EmailConfirmed",
  300. "PasswordHash",
  301. "SecurityStamp",
  302. "ConcurrencyStamp",
  303. "PhoneNumber",
  304. "PhoneNumberConfirmed",
  305. "TwoFactorEnabled",
  306. "LockoutEnd",
  307. "LockoutEnabled",
  308. "AccessFailedCount"
  309. },
  310. values: new object[]
  311. {
  312. "0bbc790f-cf94-48b3-ae77-3cc2e15a2a9b",
  313. 1,
  314. "admin",
  315. "ADMIN",
  316. false,
  317. "AQAAAAEAACcQAAAAEK9jfhMVsZdoouotsMTWpJjnY46fCL6cbWMhArAYy3ONrOQRbxHvDXl+Y8R+Hm1fQQ==",
  318. "P4EBTGKUNSAFJLYUUPOTPWPDLZWF6DJA",
  319. "342eea67-c72f-4332-9930-dd9c2662f89b",
  320. null,
  321. false,
  322. false,
  323. null,
  324. true,
  325. 0
  326. }
  327. );
  328. #endregion
  329.  
  330. #region Insert Language
  331. // Insert Default Language Attribut to System Application
  332. migrationBuilder.InsertData(
  333. table: "Dictionaries",
  334. columns: new[]
  335. {
  336. "Id",
  337. "CreatedAt",
  338. "UpdatedAt",
  339. "IsGlobal"
  340. },
  341. values: new object[]
  342. {
  343. 1,
  344. new DateTime(2019, 01, 30),
  345. new DateTime(2019, 01, 30),
  346. false
  347. }
  348. );
  349.  
  350. migrationBuilder.InsertData(
  351. table: "DictionaryItems",
  352. columns: new[]
  353. {
  354. "Id",
  355. "CreatedAt",
  356. "UpdatedAt",
  357. "Value",
  358. "DictionaryId"
  359. },
  360. values: new object[]
  361. {
  362. 1,
  363. new DateTime(2019, 01, 30),
  364. new DateTime(2019, 01, 30),
  365. "Polski",
  366. 1
  367. }
  368. );
  369.  
  370. migrationBuilder.InsertData(
  371. table: "FormAttributes",
  372. columns: new[]
  373. {
  374. "Id",
  375. "CreatedAt",
  376. "UpdatedAt",
  377. "Guid",
  378. "Name",
  379. "FormId",
  380. "AttributeTypeId",
  381. "Column",
  382. "Configuration",
  383. "Code"
  384. },
  385. values: new object[]
  386. {
  387. 4,
  388. new DateTime(2019, 01, 30),
  389. new DateTime(2019, 01, 30),
  390. Constants.UserDefaultLanguageGuid,
  391. "Default Language",
  392. 1,
  393. 6,
  394. "DropdownList1",
  395. "{\"dictionaryId\":\"1\"}",
  396. "UserDefaultLanguage"
  397. }
  398. );
  399.  
  400. migrationBuilder.InsertData(
  401. table: "Fields",
  402. columns: new[]
  403. {
  404. "Id",
  405. "CreatedAt",
  406. "UpdatedAt",
  407. "FormViewId",
  408. "PlaceholderId",
  409. "FieldPosition",
  410. "IsRequired",
  411. "IsEditable",
  412. "IsVisible",
  413. "FormAttributeId"
  414. },
  415. values: new object[]
  416. {
  417. 4,
  418. new DateTime(2019, 01, 30),
  419. new DateTime(2019, 01, 30),
  420. 1,
  421. 0,
  422. 3,
  423. true,
  424. true,
  425. true,
  426. 4
  427. }
  428. );
  429.  
  430. // Insert default Polish language to Languages table
  431. migrationBuilder.InsertData(
  432. table: "Languages",
  433. columns: new[]
  434. {
  435. "Id",
  436. "CreatedAt",
  437. "UpdatedAt",
  438. "Name",
  439. "Code"
  440. },
  441. values: new object[]
  442. {
  443. 1,
  444. new DateTime(2019, 01, 30),
  445. new DateTime(2019, 01, 30),
  446. "Polski",
  447. "PL"
  448. }
  449. );
  450.  
  451. #endregion
  452.  
  453. #region Update Admin
  454. // (DocumentId = 1)
  455. migrationBuilder.InsertData(
  456. table: "DocumentChoiceValues",
  457. columns: new[]
  458. {
  459. "Id",
  460. "CreatedAt",
  461. "UpdatedAt",
  462. "DocumentId",
  463. "FormAttributeId",
  464. "ValueId",
  465. "ValueName"
  466. },
  467. values: new object[]
  468. {
  469. 1,
  470. new DateTime(2019, 01, 30),
  471. new DateTime(2019, 01, 30),
  472. 1,
  473. 4,
  474. 1,
  475. "Polski"
  476. }
  477. );
  478. #endregion
  479.  
  480. migrationBuilder.InsertData(
  481. table: "Documents",
  482. columns: new[] {
  483. "Id",
  484. "CreatedAt",
  485. "UpdatedAt",
  486. "FormId",
  487. "Text1",
  488. "Text2"
  489. },
  490. values: new object[] {
  491. 2,
  492. new DateTime(2019, 01, 30),
  493. new DateTime(2019, 01, 30),
  494. 1,
  495. "User First Name",
  496. "User Last Name"
  497. });
  498.  
  499. //DocumentId = 2
  500. migrationBuilder.InsertData(
  501. table: "DocumentChoiceValues",
  502. columns: new[]
  503. {
  504. "Id",
  505. "CreatedAt",
  506. "UpdatedAt",
  507. "DocumentId",
  508. "FormAttributeId",
  509. "ValueId",
  510. "ValueName"
  511. },
  512. values: new object[]
  513. {
  514. 2,
  515. new DateTime(2019, 01, 30),
  516. new DateTime(2019, 01, 30),
  517. 2,
  518. 4,
  519. 1,
  520. "Polski"
  521. }
  522. );
  523.  
  524. //username: user
  525. //password: user
  526. migrationBuilder.InsertData(
  527. table: "AspNetUsers",
  528. columns: new[]
  529. {
  530. "Id",
  531. "DocumentId",
  532. "UserName",
  533. "NormalizedUserName",
  534. "EmailConfirmed",
  535. "PasswordHash",
  536. "SecurityStamp",
  537. "ConcurrencyStamp",
  538. "PhoneNumber",
  539. "PhoneNumberConfirmed",
  540. "TwoFactorEnabled",
  541. "LockoutEnd",
  542. "LockoutEnabled",
  543. "AccessFailedCount"
  544. },
  545. values: new object[]
  546. {
  547. "e02f1e94-1aa1-4b95-915e-e70d976052b9",
  548. 2,
  549. "user",
  550. "USER",
  551. false,
  552. "AQAAAAEAACcQAAAAEOeKsP12As6e7GJ4ZkrQE61Mu83Ovy56ixk25YgaEKo6ukR8azafskLbJic7yL1W2g==",
  553. "6TFI6RHMYVDGMQQO3T542PBZNCYXDH72",
  554. "7a433e9f-9bed-4796-93ce-776383a3184f",
  555. null,
  556. false,
  557. false,
  558. null,
  559. true,
  560. 0
  561. }
  562. );
  563.  
  564. migrationBuilder.InsertData(
  565. table: "ApplicationPermissions",
  566. columns: new[]
  567. {
  568. "ApplicationId",
  569. "UserId",
  570. "PermissionType",
  571. "CreatedAt",
  572. "UpdatedAt"
  573. },
  574. values: new object[]
  575. {
  576. 1,
  577. 1,
  578. (int)PermissionType.Admin,
  579. new DateTime(2019, 10, 10),
  580. new DateTime(2019, 9, 9)
  581. }
  582. );
  583.  
  584. migrationBuilder.InsertData(
  585. table: "ApplicationPermissions",
  586. columns: new[]
  587. {
  588. "ApplicationId",
  589. "UserId",
  590. "PermissionType",
  591. "CreatedAt",
  592. "UpdatedAt"
  593. },
  594. values: new object[]
  595. {
  596. 1,
  597. 2,
  598. (int)PermissionType.User,
  599. new DateTime(2019, 10, 10),
  600. new DateTime(2019, 9, 9)
  601. }
  602. );
  603.  
  604. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement