20200728005145_AddDisplayPreferences.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #pragma warning disable CS1591
  2. #pragma warning disable SA1601
  3. using System;
  4. using Microsoft.EntityFrameworkCore.Migrations;
  5. namespace Jellyfin.Server.Implementations.Migrations
  6. {
  7. public partial class AddDisplayPreferences : Migration
  8. {
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.CreateTable(
  12. name: "DisplayPreferences",
  13. schema: "jellyfin",
  14. columns: table => new
  15. {
  16. Id = table.Column<int>(nullable: false)
  17. .Annotation("Sqlite:Autoincrement", true),
  18. UserId = table.Column<Guid>(nullable: false),
  19. Client = table.Column<string>(maxLength: 32, nullable: false),
  20. ShowSidebar = table.Column<bool>(nullable: false),
  21. ShowBackdrop = table.Column<bool>(nullable: false),
  22. ScrollDirection = table.Column<int>(nullable: false),
  23. IndexBy = table.Column<int>(nullable: true),
  24. SkipForwardLength = table.Column<int>(nullable: false),
  25. SkipBackwardLength = table.Column<int>(nullable: false),
  26. ChromecastVersion = table.Column<int>(nullable: false),
  27. EnableNextVideoInfoOverlay = table.Column<bool>(nullable: false),
  28. DashboardTheme = table.Column<string>(maxLength: 32, nullable: true),
  29. TvHome = table.Column<string>(maxLength: 32, nullable: true)
  30. },
  31. constraints: table =>
  32. {
  33. table.PrimaryKey("PK_DisplayPreferences", x => x.Id);
  34. table.ForeignKey(
  35. name: "FK_DisplayPreferences_Users_UserId",
  36. column: x => x.UserId,
  37. principalSchema: "jellyfin",
  38. principalTable: "Users",
  39. principalColumn: "Id",
  40. onDelete: ReferentialAction.Cascade);
  41. });
  42. migrationBuilder.CreateTable(
  43. name: "ItemDisplayPreferences",
  44. schema: "jellyfin",
  45. columns: table => new
  46. {
  47. Id = table.Column<int>(nullable: false)
  48. .Annotation("Sqlite:Autoincrement", true),
  49. UserId = table.Column<Guid>(nullable: false),
  50. ItemId = table.Column<Guid>(nullable: false),
  51. Client = table.Column<string>(maxLength: 32, nullable: false),
  52. ViewType = table.Column<int>(nullable: false),
  53. RememberIndexing = table.Column<bool>(nullable: false),
  54. IndexBy = table.Column<int>(nullable: true),
  55. RememberSorting = table.Column<bool>(nullable: false),
  56. SortBy = table.Column<string>(maxLength: 64, nullable: false),
  57. SortOrder = table.Column<int>(nullable: false)
  58. },
  59. constraints: table =>
  60. {
  61. table.PrimaryKey("PK_ItemDisplayPreferences", x => x.Id);
  62. table.ForeignKey(
  63. name: "FK_ItemDisplayPreferences_Users_UserId",
  64. column: x => x.UserId,
  65. principalSchema: "jellyfin",
  66. principalTable: "Users",
  67. principalColumn: "Id",
  68. onDelete: ReferentialAction.Cascade);
  69. });
  70. migrationBuilder.CreateTable(
  71. name: "HomeSection",
  72. schema: "jellyfin",
  73. columns: table => new
  74. {
  75. Id = table.Column<int>(nullable: false)
  76. .Annotation("Sqlite:Autoincrement", true),
  77. DisplayPreferencesId = table.Column<int>(nullable: false),
  78. Order = table.Column<int>(nullable: false),
  79. Type = table.Column<int>(nullable: false)
  80. },
  81. constraints: table =>
  82. {
  83. table.PrimaryKey("PK_HomeSection", x => x.Id);
  84. table.ForeignKey(
  85. name: "FK_HomeSection_DisplayPreferences_DisplayPreferencesId",
  86. column: x => x.DisplayPreferencesId,
  87. principalSchema: "jellyfin",
  88. principalTable: "DisplayPreferences",
  89. principalColumn: "Id",
  90. onDelete: ReferentialAction.Cascade);
  91. });
  92. migrationBuilder.CreateIndex(
  93. name: "IX_DisplayPreferences_UserId",
  94. schema: "jellyfin",
  95. table: "DisplayPreferences",
  96. column: "UserId",
  97. unique: true);
  98. migrationBuilder.CreateIndex(
  99. name: "IX_HomeSection_DisplayPreferencesId",
  100. schema: "jellyfin",
  101. table: "HomeSection",
  102. column: "DisplayPreferencesId");
  103. migrationBuilder.CreateIndex(
  104. name: "IX_ItemDisplayPreferences_UserId",
  105. schema: "jellyfin",
  106. table: "ItemDisplayPreferences",
  107. column: "UserId");
  108. }
  109. protected override void Down(MigrationBuilder migrationBuilder)
  110. {
  111. migrationBuilder.DropTable(
  112. name: "HomeSection",
  113. schema: "jellyfin");
  114. migrationBuilder.DropTable(
  115. name: "ItemDisplayPreferences",
  116. schema: "jellyfin");
  117. migrationBuilder.DropTable(
  118. name: "DisplayPreferences",
  119. schema: "jellyfin");
  120. }
  121. }
  122. }