20241020103111_LibraryDbMigration.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Jellyfin.Server.Implementations.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class LibraryDbMigration : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "BaseItems",
  14. columns: table => new
  15. {
  16. Id = table.Column<Guid>(type: "TEXT", nullable: false),
  17. Type = table.Column<string>(type: "TEXT", nullable: false),
  18. Data = table.Column<string>(type: "TEXT", nullable: true),
  19. Path = table.Column<string>(type: "TEXT", nullable: true),
  20. StartDate = table.Column<DateTime>(type: "TEXT", nullable: false),
  21. EndDate = table.Column<DateTime>(type: "TEXT", nullable: false),
  22. ChannelId = table.Column<string>(type: "TEXT", nullable: true),
  23. IsMovie = table.Column<bool>(type: "INTEGER", nullable: false),
  24. CommunityRating = table.Column<float>(type: "REAL", nullable: true),
  25. CustomRating = table.Column<string>(type: "TEXT", nullable: true),
  26. IndexNumber = table.Column<int>(type: "INTEGER", nullable: true),
  27. IsLocked = table.Column<bool>(type: "INTEGER", nullable: false),
  28. Name = table.Column<string>(type: "TEXT", nullable: true),
  29. OfficialRating = table.Column<string>(type: "TEXT", nullable: true),
  30. MediaType = table.Column<string>(type: "TEXT", nullable: true),
  31. Overview = table.Column<string>(type: "TEXT", nullable: true),
  32. ParentIndexNumber = table.Column<int>(type: "INTEGER", nullable: true),
  33. PremiereDate = table.Column<DateTime>(type: "TEXT", nullable: true),
  34. ProductionYear = table.Column<int>(type: "INTEGER", nullable: true),
  35. Genres = table.Column<string>(type: "TEXT", nullable: true),
  36. SortName = table.Column<string>(type: "TEXT", nullable: true),
  37. ForcedSortName = table.Column<string>(type: "TEXT", nullable: true),
  38. RunTimeTicks = table.Column<long>(type: "INTEGER", nullable: true),
  39. DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true),
  40. DateModified = table.Column<DateTime>(type: "TEXT", nullable: true),
  41. IsSeries = table.Column<bool>(type: "INTEGER", nullable: false),
  42. EpisodeTitle = table.Column<string>(type: "TEXT", nullable: true),
  43. IsRepeat = table.Column<bool>(type: "INTEGER", nullable: false),
  44. PreferredMetadataLanguage = table.Column<string>(type: "TEXT", nullable: true),
  45. PreferredMetadataCountryCode = table.Column<string>(type: "TEXT", nullable: true),
  46. DateLastRefreshed = table.Column<DateTime>(type: "TEXT", nullable: true),
  47. DateLastSaved = table.Column<DateTime>(type: "TEXT", nullable: true),
  48. IsInMixedFolder = table.Column<bool>(type: "INTEGER", nullable: false),
  49. Studios = table.Column<string>(type: "TEXT", nullable: true),
  50. ExternalServiceId = table.Column<string>(type: "TEXT", nullable: true),
  51. Tags = table.Column<string>(type: "TEXT", nullable: true),
  52. IsFolder = table.Column<bool>(type: "INTEGER", nullable: false),
  53. InheritedParentalRatingValue = table.Column<int>(type: "INTEGER", nullable: true),
  54. UnratedType = table.Column<string>(type: "TEXT", nullable: true),
  55. CriticRating = table.Column<float>(type: "REAL", nullable: true),
  56. CleanName = table.Column<string>(type: "TEXT", nullable: true),
  57. PresentationUniqueKey = table.Column<string>(type: "TEXT", nullable: true),
  58. OriginalTitle = table.Column<string>(type: "TEXT", nullable: true),
  59. PrimaryVersionId = table.Column<string>(type: "TEXT", nullable: true),
  60. DateLastMediaAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
  61. Album = table.Column<string>(type: "TEXT", nullable: true),
  62. LUFS = table.Column<float>(type: "REAL", nullable: true),
  63. NormalizationGain = table.Column<float>(type: "REAL", nullable: true),
  64. IsVirtualItem = table.Column<bool>(type: "INTEGER", nullable: false),
  65. SeriesName = table.Column<string>(type: "TEXT", nullable: true),
  66. SeasonName = table.Column<string>(type: "TEXT", nullable: true),
  67. ExternalSeriesId = table.Column<string>(type: "TEXT", nullable: true),
  68. Tagline = table.Column<string>(type: "TEXT", nullable: true),
  69. ProductionLocations = table.Column<string>(type: "TEXT", nullable: true),
  70. ExtraIds = table.Column<string>(type: "TEXT", nullable: true),
  71. TotalBitrate = table.Column<int>(type: "INTEGER", nullable: true),
  72. ExtraType = table.Column<int>(type: "INTEGER", nullable: true),
  73. Artists = table.Column<string>(type: "TEXT", nullable: true),
  74. AlbumArtists = table.Column<string>(type: "TEXT", nullable: true),
  75. ExternalId = table.Column<string>(type: "TEXT", nullable: true),
  76. SeriesPresentationUniqueKey = table.Column<string>(type: "TEXT", nullable: true),
  77. ShowId = table.Column<string>(type: "TEXT", nullable: true),
  78. OwnerId = table.Column<string>(type: "TEXT", nullable: true),
  79. Width = table.Column<int>(type: "INTEGER", nullable: true),
  80. Height = table.Column<int>(type: "INTEGER", nullable: true),
  81. Size = table.Column<long>(type: "INTEGER", nullable: true),
  82. Audio = table.Column<int>(type: "INTEGER", nullable: true),
  83. ParentId = table.Column<Guid>(type: "TEXT", nullable: true),
  84. TopParentId = table.Column<Guid>(type: "TEXT", nullable: true),
  85. SeasonId = table.Column<Guid>(type: "TEXT", nullable: true),
  86. SeriesId = table.Column<Guid>(type: "TEXT", nullable: true)
  87. },
  88. constraints: table =>
  89. {
  90. table.PrimaryKey("PK_BaseItems", x => x.Id);
  91. });
  92. migrationBuilder.CreateTable(
  93. name: "ItemValues",
  94. columns: table => new
  95. {
  96. ItemValueId = table.Column<Guid>(type: "TEXT", nullable: false),
  97. Type = table.Column<int>(type: "INTEGER", nullable: false),
  98. Value = table.Column<string>(type: "TEXT", nullable: false),
  99. CleanValue = table.Column<string>(type: "TEXT", nullable: false)
  100. },
  101. constraints: table =>
  102. {
  103. table.PrimaryKey("PK_ItemValues", x => x.ItemValueId);
  104. });
  105. migrationBuilder.CreateTable(
  106. name: "Peoples",
  107. columns: table => new
  108. {
  109. Id = table.Column<Guid>(type: "TEXT", nullable: false),
  110. Name = table.Column<string>(type: "TEXT", nullable: false),
  111. PersonType = table.Column<string>(type: "TEXT", nullable: true)
  112. },
  113. constraints: table =>
  114. {
  115. table.PrimaryKey("PK_Peoples", x => x.Id);
  116. });
  117. migrationBuilder.CreateTable(
  118. name: "AncestorIds",
  119. columns: table => new
  120. {
  121. ParentItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  122. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  123. BaseItemEntityId = table.Column<Guid>(type: "TEXT", nullable: true)
  124. },
  125. constraints: table =>
  126. {
  127. table.PrimaryKey("PK_AncestorIds", x => new { x.ItemId, x.ParentItemId });
  128. table.ForeignKey(
  129. name: "FK_AncestorIds_BaseItems_BaseItemEntityId",
  130. column: x => x.BaseItemEntityId,
  131. principalTable: "BaseItems",
  132. principalColumn: "Id");
  133. table.ForeignKey(
  134. name: "FK_AncestorIds_BaseItems_ItemId",
  135. column: x => x.ItemId,
  136. principalTable: "BaseItems",
  137. principalColumn: "Id",
  138. onDelete: ReferentialAction.Cascade);
  139. table.ForeignKey(
  140. name: "FK_AncestorIds_BaseItems_ParentItemId",
  141. column: x => x.ParentItemId,
  142. principalTable: "BaseItems",
  143. principalColumn: "Id",
  144. onDelete: ReferentialAction.Cascade);
  145. });
  146. migrationBuilder.CreateTable(
  147. name: "AttachmentStreamInfos",
  148. columns: table => new
  149. {
  150. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  151. Index = table.Column<int>(type: "INTEGER", nullable: false),
  152. Codec = table.Column<string>(type: "TEXT", nullable: false),
  153. CodecTag = table.Column<string>(type: "TEXT", nullable: true),
  154. Comment = table.Column<string>(type: "TEXT", nullable: true),
  155. Filename = table.Column<string>(type: "TEXT", nullable: true),
  156. MimeType = table.Column<string>(type: "TEXT", nullable: true)
  157. },
  158. constraints: table =>
  159. {
  160. table.PrimaryKey("PK_AttachmentStreamInfos", x => new { x.ItemId, x.Index });
  161. table.ForeignKey(
  162. name: "FK_AttachmentStreamInfos_BaseItems_ItemId",
  163. column: x => x.ItemId,
  164. principalTable: "BaseItems",
  165. principalColumn: "Id",
  166. onDelete: ReferentialAction.Cascade);
  167. });
  168. migrationBuilder.CreateTable(
  169. name: "BaseItemImageInfos",
  170. columns: table => new
  171. {
  172. Id = table.Column<Guid>(type: "TEXT", nullable: false),
  173. Path = table.Column<string>(type: "TEXT", nullable: false),
  174. DateModified = table.Column<DateTime>(type: "TEXT", nullable: false),
  175. ImageType = table.Column<int>(type: "INTEGER", nullable: false),
  176. Width = table.Column<int>(type: "INTEGER", nullable: false),
  177. Height = table.Column<int>(type: "INTEGER", nullable: false),
  178. Blurhash = table.Column<byte[]>(type: "BLOB", nullable: true),
  179. ItemId = table.Column<Guid>(type: "TEXT", nullable: false)
  180. },
  181. constraints: table =>
  182. {
  183. table.PrimaryKey("PK_BaseItemImageInfos", x => x.Id);
  184. table.ForeignKey(
  185. name: "FK_BaseItemImageInfos_BaseItems_ItemId",
  186. column: x => x.ItemId,
  187. principalTable: "BaseItems",
  188. principalColumn: "Id",
  189. onDelete: ReferentialAction.Cascade);
  190. });
  191. migrationBuilder.CreateTable(
  192. name: "BaseItemMetadataFields",
  193. columns: table => new
  194. {
  195. Id = table.Column<int>(type: "INTEGER", nullable: false),
  196. ItemId = table.Column<Guid>(type: "TEXT", nullable: false)
  197. },
  198. constraints: table =>
  199. {
  200. table.PrimaryKey("PK_BaseItemMetadataFields", x => new { x.Id, x.ItemId });
  201. table.ForeignKey(
  202. name: "FK_BaseItemMetadataFields_BaseItems_ItemId",
  203. column: x => x.ItemId,
  204. principalTable: "BaseItems",
  205. principalColumn: "Id",
  206. onDelete: ReferentialAction.Cascade);
  207. });
  208. migrationBuilder.CreateTable(
  209. name: "BaseItemProviders",
  210. columns: table => new
  211. {
  212. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  213. ProviderId = table.Column<string>(type: "TEXT", nullable: false),
  214. ProviderValue = table.Column<string>(type: "TEXT", nullable: false)
  215. },
  216. constraints: table =>
  217. {
  218. table.PrimaryKey("PK_BaseItemProviders", x => new { x.ItemId, x.ProviderId });
  219. table.ForeignKey(
  220. name: "FK_BaseItemProviders_BaseItems_ItemId",
  221. column: x => x.ItemId,
  222. principalTable: "BaseItems",
  223. principalColumn: "Id",
  224. onDelete: ReferentialAction.Cascade);
  225. });
  226. migrationBuilder.CreateTable(
  227. name: "BaseItemTrailerTypes",
  228. columns: table => new
  229. {
  230. Id = table.Column<int>(type: "INTEGER", nullable: false),
  231. ItemId = table.Column<Guid>(type: "TEXT", nullable: false)
  232. },
  233. constraints: table =>
  234. {
  235. table.PrimaryKey("PK_BaseItemTrailerTypes", x => new { x.Id, x.ItemId });
  236. table.ForeignKey(
  237. name: "FK_BaseItemTrailerTypes_BaseItems_ItemId",
  238. column: x => x.ItemId,
  239. principalTable: "BaseItems",
  240. principalColumn: "Id",
  241. onDelete: ReferentialAction.Cascade);
  242. });
  243. migrationBuilder.CreateTable(
  244. name: "Chapters",
  245. columns: table => new
  246. {
  247. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  248. ChapterIndex = table.Column<int>(type: "INTEGER", nullable: false),
  249. StartPositionTicks = table.Column<long>(type: "INTEGER", nullable: false),
  250. Name = table.Column<string>(type: "TEXT", nullable: true),
  251. ImagePath = table.Column<string>(type: "TEXT", nullable: true),
  252. ImageDateModified = table.Column<DateTime>(type: "TEXT", nullable: true)
  253. },
  254. constraints: table =>
  255. {
  256. table.PrimaryKey("PK_Chapters", x => new { x.ItemId, x.ChapterIndex });
  257. table.ForeignKey(
  258. name: "FK_Chapters_BaseItems_ItemId",
  259. column: x => x.ItemId,
  260. principalTable: "BaseItems",
  261. principalColumn: "Id",
  262. onDelete: ReferentialAction.Cascade);
  263. });
  264. migrationBuilder.CreateTable(
  265. name: "MediaStreamInfos",
  266. columns: table => new
  267. {
  268. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  269. StreamIndex = table.Column<int>(type: "INTEGER", nullable: false),
  270. StreamType = table.Column<int>(type: "INTEGER", nullable: true),
  271. Codec = table.Column<string>(type: "TEXT", nullable: true),
  272. Language = table.Column<string>(type: "TEXT", nullable: true),
  273. ChannelLayout = table.Column<string>(type: "TEXT", nullable: true),
  274. Profile = table.Column<string>(type: "TEXT", nullable: true),
  275. AspectRatio = table.Column<string>(type: "TEXT", nullable: true),
  276. Path = table.Column<string>(type: "TEXT", nullable: true),
  277. IsInterlaced = table.Column<bool>(type: "INTEGER", nullable: false),
  278. BitRate = table.Column<int>(type: "INTEGER", nullable: false),
  279. Channels = table.Column<int>(type: "INTEGER", nullable: false),
  280. SampleRate = table.Column<int>(type: "INTEGER", nullable: false),
  281. IsDefault = table.Column<bool>(type: "INTEGER", nullable: false),
  282. IsForced = table.Column<bool>(type: "INTEGER", nullable: false),
  283. IsExternal = table.Column<bool>(type: "INTEGER", nullable: false),
  284. Height = table.Column<int>(type: "INTEGER", nullable: false),
  285. Width = table.Column<int>(type: "INTEGER", nullable: false),
  286. AverageFrameRate = table.Column<float>(type: "REAL", nullable: false),
  287. RealFrameRate = table.Column<float>(type: "REAL", nullable: false),
  288. Level = table.Column<float>(type: "REAL", nullable: false),
  289. PixelFormat = table.Column<string>(type: "TEXT", nullable: true),
  290. BitDepth = table.Column<int>(type: "INTEGER", nullable: false),
  291. IsAnamorphic = table.Column<bool>(type: "INTEGER", nullable: false),
  292. RefFrames = table.Column<int>(type: "INTEGER", nullable: false),
  293. CodecTag = table.Column<string>(type: "TEXT", nullable: false),
  294. Comment = table.Column<string>(type: "TEXT", nullable: false),
  295. NalLengthSize = table.Column<string>(type: "TEXT", nullable: false),
  296. IsAvc = table.Column<bool>(type: "INTEGER", nullable: false),
  297. Title = table.Column<string>(type: "TEXT", nullable: false),
  298. TimeBase = table.Column<string>(type: "TEXT", nullable: false),
  299. CodecTimeBase = table.Column<string>(type: "TEXT", nullable: false),
  300. ColorPrimaries = table.Column<string>(type: "TEXT", nullable: false),
  301. ColorSpace = table.Column<string>(type: "TEXT", nullable: false),
  302. ColorTransfer = table.Column<string>(type: "TEXT", nullable: false),
  303. DvVersionMajor = table.Column<int>(type: "INTEGER", nullable: false),
  304. DvVersionMinor = table.Column<int>(type: "INTEGER", nullable: false),
  305. DvProfile = table.Column<int>(type: "INTEGER", nullable: false),
  306. DvLevel = table.Column<int>(type: "INTEGER", nullable: false),
  307. RpuPresentFlag = table.Column<int>(type: "INTEGER", nullable: false),
  308. ElPresentFlag = table.Column<int>(type: "INTEGER", nullable: false),
  309. BlPresentFlag = table.Column<int>(type: "INTEGER", nullable: false),
  310. DvBlSignalCompatibilityId = table.Column<int>(type: "INTEGER", nullable: false),
  311. IsHearingImpaired = table.Column<bool>(type: "INTEGER", nullable: false),
  312. Rotation = table.Column<int>(type: "INTEGER", nullable: false),
  313. KeyFrames = table.Column<string>(type: "TEXT", nullable: true)
  314. },
  315. constraints: table =>
  316. {
  317. table.PrimaryKey("PK_MediaStreamInfos", x => new { x.ItemId, x.StreamIndex });
  318. table.ForeignKey(
  319. name: "FK_MediaStreamInfos_BaseItems_ItemId",
  320. column: x => x.ItemId,
  321. principalTable: "BaseItems",
  322. principalColumn: "Id",
  323. onDelete: ReferentialAction.Cascade);
  324. });
  325. migrationBuilder.CreateTable(
  326. name: "UserData",
  327. columns: table => new
  328. {
  329. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  330. UserId = table.Column<Guid>(type: "TEXT", nullable: false),
  331. Rating = table.Column<double>(type: "REAL", nullable: true),
  332. PlaybackPositionTicks = table.Column<long>(type: "INTEGER", nullable: false),
  333. PlayCount = table.Column<int>(type: "INTEGER", nullable: false),
  334. IsFavorite = table.Column<bool>(type: "INTEGER", nullable: false),
  335. LastPlayedDate = table.Column<DateTime>(type: "TEXT", nullable: true),
  336. Played = table.Column<bool>(type: "INTEGER", nullable: false),
  337. AudioStreamIndex = table.Column<int>(type: "INTEGER", nullable: true),
  338. SubtitleStreamIndex = table.Column<int>(type: "INTEGER", nullable: true),
  339. Likes = table.Column<bool>(type: "INTEGER", nullable: true)
  340. },
  341. constraints: table =>
  342. {
  343. table.PrimaryKey("PK_UserData", x => new { x.ItemId, x.UserId });
  344. table.ForeignKey(
  345. name: "FK_UserData_BaseItems_ItemId",
  346. column: x => x.ItemId,
  347. principalTable: "BaseItems",
  348. principalColumn: "Id",
  349. onDelete: ReferentialAction.Cascade);
  350. table.ForeignKey(
  351. name: "FK_UserData_Users_UserId",
  352. column: x => x.UserId,
  353. principalTable: "Users",
  354. principalColumn: "Id",
  355. onDelete: ReferentialAction.Cascade);
  356. });
  357. migrationBuilder.CreateTable(
  358. name: "ItemValuesMap",
  359. columns: table => new
  360. {
  361. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  362. ItemValueId = table.Column<Guid>(type: "TEXT", nullable: false)
  363. },
  364. constraints: table =>
  365. {
  366. table.PrimaryKey("PK_ItemValuesMap", x => new { x.ItemValueId, x.ItemId });
  367. table.ForeignKey(
  368. name: "FK_ItemValuesMap_BaseItems_ItemId",
  369. column: x => x.ItemId,
  370. principalTable: "BaseItems",
  371. principalColumn: "Id",
  372. onDelete: ReferentialAction.Cascade);
  373. table.ForeignKey(
  374. name: "FK_ItemValuesMap_ItemValues_ItemValueId",
  375. column: x => x.ItemValueId,
  376. principalTable: "ItemValues",
  377. principalColumn: "ItemValueId",
  378. onDelete: ReferentialAction.Cascade);
  379. });
  380. migrationBuilder.CreateTable(
  381. name: "PeopleBaseItemMap",
  382. columns: table => new
  383. {
  384. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  385. PeopleId = table.Column<Guid>(type: "TEXT", nullable: false),
  386. SortOrder = table.Column<int>(type: "INTEGER", nullable: true),
  387. ListOrder = table.Column<int>(type: "INTEGER", nullable: true),
  388. Role = table.Column<string>(type: "TEXT", nullable: true)
  389. },
  390. constraints: table =>
  391. {
  392. table.PrimaryKey("PK_PeopleBaseItemMap", x => new { x.ItemId, x.PeopleId });
  393. table.ForeignKey(
  394. name: "FK_PeopleBaseItemMap_BaseItems_ItemId",
  395. column: x => x.ItemId,
  396. principalTable: "BaseItems",
  397. principalColumn: "Id",
  398. onDelete: ReferentialAction.Cascade);
  399. table.ForeignKey(
  400. name: "FK_PeopleBaseItemMap_Peoples_PeopleId",
  401. column: x => x.PeopleId,
  402. principalTable: "Peoples",
  403. principalColumn: "Id",
  404. onDelete: ReferentialAction.Cascade);
  405. });
  406. migrationBuilder.CreateIndex(
  407. name: "IX_AncestorIds_BaseItemEntityId",
  408. table: "AncestorIds",
  409. column: "BaseItemEntityId");
  410. migrationBuilder.CreateIndex(
  411. name: "IX_AncestorIds_ParentItemId",
  412. table: "AncestorIds",
  413. column: "ParentItemId");
  414. migrationBuilder.CreateIndex(
  415. name: "IX_BaseItemImageInfos_ItemId",
  416. table: "BaseItemImageInfos",
  417. column: "ItemId");
  418. migrationBuilder.CreateIndex(
  419. name: "IX_BaseItemMetadataFields_ItemId",
  420. table: "BaseItemMetadataFields",
  421. column: "ItemId");
  422. migrationBuilder.CreateIndex(
  423. name: "IX_BaseItemProviders_ProviderId_ProviderValue_ItemId",
  424. table: "BaseItemProviders",
  425. columns: new[] { "ProviderId", "ProviderValue", "ItemId" });
  426. migrationBuilder.CreateIndex(
  427. name: "IX_BaseItems_Id_Type_IsFolder_IsVirtualItem",
  428. table: "BaseItems",
  429. columns: new[] { "Id", "Type", "IsFolder", "IsVirtualItem" });
  430. migrationBuilder.CreateIndex(
  431. name: "IX_BaseItems_IsFolder_TopParentId_IsVirtualItem_PresentationUniqueKey_DateCreated",
  432. table: "BaseItems",
  433. columns: new[] { "IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated" });
  434. migrationBuilder.CreateIndex(
  435. name: "IX_BaseItems_MediaType_TopParentId_IsVirtualItem_PresentationUniqueKey",
  436. table: "BaseItems",
  437. columns: new[] { "MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey" });
  438. migrationBuilder.CreateIndex(
  439. name: "IX_BaseItems_ParentId",
  440. table: "BaseItems",
  441. column: "ParentId");
  442. migrationBuilder.CreateIndex(
  443. name: "IX_BaseItems_Path",
  444. table: "BaseItems",
  445. column: "Path");
  446. migrationBuilder.CreateIndex(
  447. name: "IX_BaseItems_PresentationUniqueKey",
  448. table: "BaseItems",
  449. column: "PresentationUniqueKey");
  450. migrationBuilder.CreateIndex(
  451. name: "IX_BaseItems_TopParentId_Id",
  452. table: "BaseItems",
  453. columns: new[] { "TopParentId", "Id" });
  454. migrationBuilder.CreateIndex(
  455. name: "IX_BaseItems_Type_SeriesPresentationUniqueKey_IsFolder_IsVirtualItem",
  456. table: "BaseItems",
  457. columns: new[] { "Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem" });
  458. migrationBuilder.CreateIndex(
  459. name: "IX_BaseItems_Type_SeriesPresentationUniqueKey_PresentationUniqueKey_SortName",
  460. table: "BaseItems",
  461. columns: new[] { "Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName" });
  462. migrationBuilder.CreateIndex(
  463. name: "IX_BaseItems_Type_TopParentId_Id",
  464. table: "BaseItems",
  465. columns: new[] { "Type", "TopParentId", "Id" });
  466. migrationBuilder.CreateIndex(
  467. name: "IX_BaseItems_Type_TopParentId_IsVirtualItem_PresentationUniqueKey_DateCreated",
  468. table: "BaseItems",
  469. columns: new[] { "Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated" });
  470. migrationBuilder.CreateIndex(
  471. name: "IX_BaseItems_Type_TopParentId_PresentationUniqueKey",
  472. table: "BaseItems",
  473. columns: new[] { "Type", "TopParentId", "PresentationUniqueKey" });
  474. migrationBuilder.CreateIndex(
  475. name: "IX_BaseItems_Type_TopParentId_StartDate",
  476. table: "BaseItems",
  477. columns: new[] { "Type", "TopParentId", "StartDate" });
  478. migrationBuilder.CreateIndex(
  479. name: "IX_BaseItemTrailerTypes_ItemId",
  480. table: "BaseItemTrailerTypes",
  481. column: "ItemId");
  482. migrationBuilder.CreateIndex(
  483. name: "IX_ItemValues_Type_CleanValue",
  484. table: "ItemValues",
  485. columns: new[] { "Type", "CleanValue" });
  486. migrationBuilder.CreateIndex(
  487. name: "IX_ItemValuesMap_ItemId",
  488. table: "ItemValuesMap",
  489. column: "ItemId");
  490. migrationBuilder.CreateIndex(
  491. name: "IX_MediaStreamInfos_StreamIndex",
  492. table: "MediaStreamInfos",
  493. column: "StreamIndex");
  494. migrationBuilder.CreateIndex(
  495. name: "IX_MediaStreamInfos_StreamIndex_StreamType",
  496. table: "MediaStreamInfos",
  497. columns: new[] { "StreamIndex", "StreamType" });
  498. migrationBuilder.CreateIndex(
  499. name: "IX_MediaStreamInfos_StreamIndex_StreamType_Language",
  500. table: "MediaStreamInfos",
  501. columns: new[] { "StreamIndex", "StreamType", "Language" });
  502. migrationBuilder.CreateIndex(
  503. name: "IX_MediaStreamInfos_StreamType",
  504. table: "MediaStreamInfos",
  505. column: "StreamType");
  506. migrationBuilder.CreateIndex(
  507. name: "IX_PeopleBaseItemMap_ItemId_ListOrder",
  508. table: "PeopleBaseItemMap",
  509. columns: new[] { "ItemId", "ListOrder" });
  510. migrationBuilder.CreateIndex(
  511. name: "IX_PeopleBaseItemMap_ItemId_SortOrder",
  512. table: "PeopleBaseItemMap",
  513. columns: new[] { "ItemId", "SortOrder" });
  514. migrationBuilder.CreateIndex(
  515. name: "IX_PeopleBaseItemMap_PeopleId",
  516. table: "PeopleBaseItemMap",
  517. column: "PeopleId");
  518. migrationBuilder.CreateIndex(
  519. name: "IX_Peoples_Name",
  520. table: "Peoples",
  521. column: "Name");
  522. migrationBuilder.CreateIndex(
  523. name: "IX_UserData_ItemId_UserId_IsFavorite",
  524. table: "UserData",
  525. columns: new[] { "ItemId", "UserId", "IsFavorite" });
  526. migrationBuilder.CreateIndex(
  527. name: "IX_UserData_ItemId_UserId_LastPlayedDate",
  528. table: "UserData",
  529. columns: new[] { "ItemId", "UserId", "LastPlayedDate" });
  530. migrationBuilder.CreateIndex(
  531. name: "IX_UserData_ItemId_UserId_PlaybackPositionTicks",
  532. table: "UserData",
  533. columns: new[] { "ItemId", "UserId", "PlaybackPositionTicks" });
  534. migrationBuilder.CreateIndex(
  535. name: "IX_UserData_ItemId_UserId_Played",
  536. table: "UserData",
  537. columns: new[] { "ItemId", "UserId", "Played" });
  538. migrationBuilder.CreateIndex(
  539. name: "IX_UserData_UserId",
  540. table: "UserData",
  541. column: "UserId");
  542. }
  543. /// <inheritdoc />
  544. protected override void Down(MigrationBuilder migrationBuilder)
  545. {
  546. migrationBuilder.DropTable(
  547. name: "AncestorIds");
  548. migrationBuilder.DropTable(
  549. name: "AttachmentStreamInfos");
  550. migrationBuilder.DropTable(
  551. name: "BaseItemImageInfos");
  552. migrationBuilder.DropTable(
  553. name: "BaseItemMetadataFields");
  554. migrationBuilder.DropTable(
  555. name: "BaseItemProviders");
  556. migrationBuilder.DropTable(
  557. name: "BaseItemTrailerTypes");
  558. migrationBuilder.DropTable(
  559. name: "Chapters");
  560. migrationBuilder.DropTable(
  561. name: "ItemValuesMap");
  562. migrationBuilder.DropTable(
  563. name: "MediaStreamInfos");
  564. migrationBuilder.DropTable(
  565. name: "PeopleBaseItemMap");
  566. migrationBuilder.DropTable(
  567. name: "UserData");
  568. migrationBuilder.DropTable(
  569. name: "ItemValues");
  570. migrationBuilder.DropTable(
  571. name: "Peoples");
  572. migrationBuilder.DropTable(
  573. name: "BaseItems");
  574. }
  575. }
  576. }