API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20200107112926_test.cs 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. using Microsoft.EntityFrameworkCore.Metadata;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace UnivateProperties_API.Migrations
  4. {
  5. public partial class test : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.DropForeignKey(
  10. name: "FK_UnitConfigurationTypes_UnitConfigurations_UnitConfiguration~",
  11. table: "UnitConfigurationTypes");
  12. //migrationBuilder.DropIndex(
  13. // name: "IX_Users_Username",
  14. // table: "Users");
  15. migrationBuilder.DropIndex(
  16. name: "IX_UnitConfigurations_Code",
  17. table: "UnitConfigurations");
  18. //migrationBuilder.DropIndex(
  19. // name: "IX_Individuals_Telephone_CellNumber_Email",
  20. // table: "Individuals");
  21. migrationBuilder.AlterColumn<int>(
  22. name: "Id",
  23. table: "Weeks",
  24. nullable: false,
  25. oldClrType: typeof(int))
  26. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  27. migrationBuilder.AlterColumn<int>(
  28. name: "Id",
  29. table: "Users",
  30. nullable: false,
  31. oldClrType: typeof(int))
  32. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  33. migrationBuilder.AlterColumn<int>(
  34. name: "Id",
  35. table: "UserDefinedGroups",
  36. nullable: false,
  37. oldClrType: typeof(int))
  38. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  39. migrationBuilder.AlterColumn<int>(
  40. name: "Id",
  41. table: "UserDefinedFields",
  42. nullable: false,
  43. oldClrType: typeof(int))
  44. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  45. migrationBuilder.AlterColumn<int>(
  46. name: "Id",
  47. table: "UnitConfigurationTypes",
  48. nullable: false,
  49. oldClrType: typeof(int))
  50. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  51. migrationBuilder.AlterColumn<int>(
  52. name: "Id",
  53. table: "UnitConfigurations",
  54. nullable: false,
  55. oldClrType: typeof(int))
  56. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  57. migrationBuilder.AlterColumn<int>(
  58. name: "Id",
  59. table: "Templates",
  60. nullable: false,
  61. oldClrType: typeof(int))
  62. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  63. migrationBuilder.AlterColumn<int>(
  64. name: "Id",
  65. table: "Suburbs",
  66. nullable: false,
  67. oldClrType: typeof(int))
  68. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  69. migrationBuilder.AlterColumn<int>(
  70. name: "Id",
  71. table: "Status",
  72. nullable: false,
  73. oldClrType: typeof(int))
  74. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  75. migrationBuilder.AlterColumn<int>(
  76. name: "Id",
  77. table: "Seasons",
  78. nullable: false,
  79. oldClrType: typeof(int))
  80. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  81. migrationBuilder.AlterColumn<int>(
  82. name: "Id",
  83. table: "SearchLogs",
  84. nullable: false,
  85. oldClrType: typeof(int))
  86. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  87. migrationBuilder.AlterColumn<int>(
  88. name: "Id",
  89. table: "Provinces",
  90. nullable: false,
  91. oldClrType: typeof(int))
  92. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  93. migrationBuilder.AlterColumn<int>(
  94. name: "Id",
  95. table: "PropertyUserFields",
  96. nullable: false,
  97. oldClrType: typeof(int))
  98. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  99. migrationBuilder.AlterColumn<int>(
  100. name: "Id",
  101. table: "PropertyTypes",
  102. nullable: false,
  103. oldClrType: typeof(int))
  104. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  105. migrationBuilder.AlterColumn<int>(
  106. name: "Id",
  107. table: "PropertyImages",
  108. nullable: false,
  109. oldClrType: typeof(int))
  110. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  111. migrationBuilder.AlterColumn<int>(
  112. name: "Id",
  113. table: "Properties",
  114. nullable: false,
  115. oldClrType: typeof(int))
  116. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  117. migrationBuilder.AlterColumn<int>(
  118. name: "Id",
  119. table: "ProcessFlows",
  120. nullable: false,
  121. oldClrType: typeof(int))
  122. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  123. migrationBuilder.AlterColumn<int>(
  124. name: "Id",
  125. table: "PlaceHolders",
  126. nullable: false,
  127. oldClrType: typeof(int))
  128. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  129. migrationBuilder.AlterColumn<int>(
  130. name: "Id",
  131. table: "Person",
  132. nullable: false,
  133. oldClrType: typeof(int))
  134. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  135. migrationBuilder.AlterColumn<int>(
  136. name: "Id",
  137. table: "Location",
  138. nullable: false,
  139. oldClrType: typeof(int))
  140. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  141. migrationBuilder.AlterColumn<int>(
  142. name: "Id",
  143. table: "Individuals",
  144. nullable: false,
  145. oldClrType: typeof(int))
  146. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  147. migrationBuilder.AlterColumn<int>(
  148. name: "Id",
  149. table: "Hosts",
  150. nullable: false,
  151. oldClrType: typeof(int))
  152. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  153. migrationBuilder.AlterColumn<int>(
  154. name: "Id",
  155. table: "Emails",
  156. nullable: false,
  157. oldClrType: typeof(int))
  158. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  159. migrationBuilder.AlterColumn<int>(
  160. name: "Id",
  161. table: "Cities",
  162. nullable: false,
  163. oldClrType: typeof(int))
  164. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  165. migrationBuilder.AlterColumn<int>(
  166. name: "Id",
  167. table: "Carousel",
  168. nullable: false,
  169. oldClrType: typeof(int))
  170. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  171. migrationBuilder.AlterColumn<int>(
  172. name: "Id",
  173. table: "BidItems",
  174. nullable: false,
  175. oldClrType: typeof(int))
  176. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  177. migrationBuilder.AlterColumn<int>(
  178. name: "Id",
  179. table: "Banks",
  180. nullable: false,
  181. oldClrType: typeof(int))
  182. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  183. migrationBuilder.AlterColumn<int>(
  184. name: "Id",
  185. table: "BankAccounts",
  186. nullable: false,
  187. oldClrType: typeof(int))
  188. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  189. migrationBuilder.AlterColumn<int>(
  190. name: "Id",
  191. table: "Agents",
  192. nullable: false,
  193. oldClrType: typeof(int))
  194. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  195. migrationBuilder.AlterColumn<int>(
  196. name: "Id",
  197. table: "Agencies",
  198. nullable: false,
  199. oldClrType: typeof(int))
  200. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  201. migrationBuilder.AlterColumn<int>(
  202. name: "Id",
  203. table: "Addresses",
  204. nullable: false,
  205. oldClrType: typeof(int))
  206. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  207. migrationBuilder.AlterColumn<int>(
  208. name: "Id",
  209. table: "Accounts",
  210. nullable: false,
  211. oldClrType: typeof(int))
  212. .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  213. //migrationBuilder.CreateIndex(
  214. // name: "IX_Users_Username",
  215. // table: "Users",
  216. // column: "Username",
  217. // unique: true,
  218. // filter: "[Username] IS NOT NULL");
  219. //migrationBuilder.CreateIndex(
  220. // name: "IX_UnitConfigurations_Code",
  221. // table: "UnitConfigurations",
  222. // column: "Code",
  223. // unique: true,
  224. // filter: "[Code] IS NOT NULL");
  225. //migrationBuilder.CreateIndex(
  226. // name: "IX_Individuals_Telephone_CellNumber_Email",
  227. // table: "Individuals",
  228. // columns: new[] { "Telephone", "CellNumber", "Email" },
  229. // unique: true,
  230. // filter: "[Telephone] IS NOT NULL AND [CellNumber] IS NOT NULL AND [Email] IS NOT NULL");
  231. migrationBuilder.AddForeignKey(
  232. name: "FK_UnitConfigurationTypes_UnitConfigurations_UnitConfigurationId",
  233. table: "UnitConfigurationTypes",
  234. column: "UnitConfigurationId",
  235. principalTable: "UnitConfigurations",
  236. principalColumn: "Id",
  237. onDelete: ReferentialAction.Cascade);
  238. }
  239. protected override void Down(MigrationBuilder migrationBuilder)
  240. {
  241. migrationBuilder.DropForeignKey(
  242. name: "FK_UnitConfigurationTypes_UnitConfigurations_UnitConfigurationId",
  243. table: "UnitConfigurationTypes");
  244. //migrationBuilder.DropIndex(
  245. // name: "IX_Users_Username",
  246. // table: "Users");
  247. //migrationBuilder.DropIndex(
  248. // name: "IX_UnitConfigurations_Code",
  249. // table: "UnitConfigurations");
  250. //migrationBuilder.DropIndex(
  251. // name: "IX_Individuals_Telephone_CellNumber_Email",
  252. // table: "Individuals");
  253. migrationBuilder.AlterColumn<int>(
  254. name: "Id",
  255. table: "Weeks",
  256. nullable: false,
  257. oldClrType: typeof(int))
  258. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  259. migrationBuilder.AlterColumn<int>(
  260. name: "Id",
  261. table: "Users",
  262. nullable: false,
  263. oldClrType: typeof(int))
  264. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  265. migrationBuilder.AlterColumn<int>(
  266. name: "Id",
  267. table: "UserDefinedGroups",
  268. nullable: false,
  269. oldClrType: typeof(int))
  270. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  271. migrationBuilder.AlterColumn<int>(
  272. name: "Id",
  273. table: "UserDefinedFields",
  274. nullable: false,
  275. oldClrType: typeof(int))
  276. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  277. migrationBuilder.AlterColumn<int>(
  278. name: "Id",
  279. table: "UnitConfigurationTypes",
  280. nullable: false,
  281. oldClrType: typeof(int))
  282. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  283. migrationBuilder.AlterColumn<int>(
  284. name: "Id",
  285. table: "UnitConfigurations",
  286. nullable: false,
  287. oldClrType: typeof(int))
  288. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  289. migrationBuilder.AlterColumn<int>(
  290. name: "Id",
  291. table: "Templates",
  292. nullable: false,
  293. oldClrType: typeof(int))
  294. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  295. migrationBuilder.AlterColumn<int>(
  296. name: "Id",
  297. table: "Suburbs",
  298. nullable: false,
  299. oldClrType: typeof(int))
  300. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  301. migrationBuilder.AlterColumn<int>(
  302. name: "Id",
  303. table: "Status",
  304. nullable: false,
  305. oldClrType: typeof(int))
  306. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  307. migrationBuilder.AlterColumn<int>(
  308. name: "Id",
  309. table: "Seasons",
  310. nullable: false,
  311. oldClrType: typeof(int))
  312. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  313. migrationBuilder.AlterColumn<int>(
  314. name: "Id",
  315. table: "SearchLogs",
  316. nullable: false,
  317. oldClrType: typeof(int))
  318. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  319. migrationBuilder.AlterColumn<int>(
  320. name: "Id",
  321. table: "Provinces",
  322. nullable: false,
  323. oldClrType: typeof(int))
  324. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  325. migrationBuilder.AlterColumn<int>(
  326. name: "Id",
  327. table: "PropertyUserFields",
  328. nullable: false,
  329. oldClrType: typeof(int))
  330. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  331. migrationBuilder.AlterColumn<int>(
  332. name: "Id",
  333. table: "PropertyTypes",
  334. nullable: false,
  335. oldClrType: typeof(int))
  336. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  337. migrationBuilder.AlterColumn<int>(
  338. name: "Id",
  339. table: "PropertyImages",
  340. nullable: false,
  341. oldClrType: typeof(int))
  342. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  343. migrationBuilder.AlterColumn<int>(
  344. name: "Id",
  345. table: "Properties",
  346. nullable: false,
  347. oldClrType: typeof(int))
  348. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  349. migrationBuilder.AlterColumn<int>(
  350. name: "Id",
  351. table: "ProcessFlows",
  352. nullable: false,
  353. oldClrType: typeof(int))
  354. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  355. migrationBuilder.AlterColumn<int>(
  356. name: "Id",
  357. table: "PlaceHolders",
  358. nullable: false,
  359. oldClrType: typeof(int))
  360. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  361. migrationBuilder.AlterColumn<int>(
  362. name: "Id",
  363. table: "Person",
  364. nullable: false,
  365. oldClrType: typeof(int))
  366. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  367. migrationBuilder.AlterColumn<int>(
  368. name: "Id",
  369. table: "Location",
  370. nullable: false,
  371. oldClrType: typeof(int))
  372. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  373. migrationBuilder.AlterColumn<int>(
  374. name: "Id",
  375. table: "Individuals",
  376. nullable: false,
  377. oldClrType: typeof(int))
  378. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  379. migrationBuilder.AlterColumn<int>(
  380. name: "Id",
  381. table: "Hosts",
  382. nullable: false,
  383. oldClrType: typeof(int))
  384. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  385. migrationBuilder.AlterColumn<int>(
  386. name: "Id",
  387. table: "Emails",
  388. nullable: false,
  389. oldClrType: typeof(int))
  390. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  391. migrationBuilder.AlterColumn<int>(
  392. name: "Id",
  393. table: "Cities",
  394. nullable: false,
  395. oldClrType: typeof(int))
  396. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  397. migrationBuilder.AlterColumn<int>(
  398. name: "Id",
  399. table: "Carousel",
  400. nullable: false,
  401. oldClrType: typeof(int))
  402. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  403. migrationBuilder.AlterColumn<int>(
  404. name: "Id",
  405. table: "BidItems",
  406. nullable: false,
  407. oldClrType: typeof(int))
  408. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  409. migrationBuilder.AlterColumn<int>(
  410. name: "Id",
  411. table: "Banks",
  412. nullable: false,
  413. oldClrType: typeof(int))
  414. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  415. migrationBuilder.AlterColumn<int>(
  416. name: "Id",
  417. table: "BankAccounts",
  418. nullable: false,
  419. oldClrType: typeof(int))
  420. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  421. migrationBuilder.AlterColumn<int>(
  422. name: "Id",
  423. table: "Agents",
  424. nullable: false,
  425. oldClrType: typeof(int))
  426. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  427. migrationBuilder.AlterColumn<int>(
  428. name: "Id",
  429. table: "Agencies",
  430. nullable: false,
  431. oldClrType: typeof(int))
  432. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  433. migrationBuilder.AlterColumn<int>(
  434. name: "Id",
  435. table: "Addresses",
  436. nullable: false,
  437. oldClrType: typeof(int))
  438. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  439. migrationBuilder.AlterColumn<int>(
  440. name: "Id",
  441. table: "Accounts",
  442. nullable: false,
  443. oldClrType: typeof(int))
  444. .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  445. //migrationBuilder.CreateIndex(
  446. // name: "IX_Users_Username",
  447. // table: "Users",
  448. // column: "Username",
  449. // unique: true);
  450. migrationBuilder.CreateIndex(
  451. name: "IX_UnitConfigurations_Code",
  452. table: "UnitConfigurations",
  453. column: "Code",
  454. unique: true);
  455. migrationBuilder.CreateIndex(
  456. name: "IX_Individuals_Telephone_CellNumber_Email",
  457. table: "Individuals",
  458. columns: new[] { "Telephone", "CellNumber", "Email" },
  459. unique: true);
  460. migrationBuilder.AddForeignKey(
  461. name: "FK_UnitConfigurationTypes_UnitConfigurations_UnitConfiguration~",
  462. table: "UnitConfigurationTypes",
  463. column: "UnitConfigurationId",
  464. principalTable: "UnitConfigurations",
  465. principalColumn: "Id",
  466. onDelete: ReferentialAction.Cascade);
  467. }
  468. }
  469. }