20200717233541_AddDisplayPreferences.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. ItemId = table.Column<Guid>(nullable: true),
  20. Client = table.Column<string>(maxLength: 64, nullable: false),
  21. RememberIndexing = table.Column<bool>(nullable: false),
  22. RememberSorting = table.Column<bool>(nullable: false),
  23. SortOrder = table.Column<int>(nullable: false),
  24. ShowSidebar = table.Column<bool>(nullable: false),
  25. ShowBackdrop = table.Column<bool>(nullable: false),
  26. SortBy = table.Column<string>(maxLength: 64, nullable: true),
  27. ViewType = table.Column<int>(nullable: true),
  28. ScrollDirection = table.Column<int>(nullable: false),
  29. IndexBy = table.Column<int>(nullable: true),
  30. SkipForwardLength = table.Column<int>(nullable: false),
  31. SkipBackwardLength = table.Column<int>(nullable: false),
  32. ChromecastVersion = table.Column<int>(nullable: false),
  33. EnableNextVideoInfoOverlay = table.Column<bool>(nullable: false)
  34. },
  35. constraints: table =>
  36. {
  37. table.PrimaryKey("PK_DisplayPreferences", x => x.Id);
  38. table.ForeignKey(
  39. name: "FK_DisplayPreferences_Users_UserId",
  40. column: x => x.UserId,
  41. principalSchema: "jellyfin",
  42. principalTable: "Users",
  43. principalColumn: "Id",
  44. onDelete: ReferentialAction.Cascade);
  45. });
  46. migrationBuilder.CreateTable(
  47. name: "HomeSection",
  48. schema: "jellyfin",
  49. columns: table => new
  50. {
  51. Id = table.Column<int>(nullable: false)
  52. .Annotation("Sqlite:Autoincrement", true),
  53. DisplayPreferencesId = table.Column<int>(nullable: false),
  54. Order = table.Column<int>(nullable: false),
  55. Type = table.Column<int>(nullable: false)
  56. },
  57. constraints: table =>
  58. {
  59. table.PrimaryKey("PK_HomeSection", x => x.Id);
  60. table.ForeignKey(
  61. name: "FK_HomeSection_DisplayPreferences_DisplayPreferencesId",
  62. column: x => x.DisplayPreferencesId,
  63. principalSchema: "jellyfin",
  64. principalTable: "DisplayPreferences",
  65. principalColumn: "Id",
  66. onDelete: ReferentialAction.Cascade);
  67. });
  68. migrationBuilder.CreateIndex(
  69. name: "IX_DisplayPreferences_UserId",
  70. schema: "jellyfin",
  71. table: "DisplayPreferences",
  72. column: "UserId");
  73. migrationBuilder.CreateIndex(
  74. name: "IX_HomeSection_DisplayPreferencesId",
  75. schema: "jellyfin",
  76. table: "HomeSection",
  77. column: "DisplayPreferencesId");
  78. }
  79. protected override void Down(MigrationBuilder migrationBuilder)
  80. {
  81. migrationBuilder.DropTable(
  82. name: "HomeSection",
  83. schema: "jellyfin");
  84. migrationBuilder.DropTable(
  85. name: "DisplayPreferences",
  86. schema: "jellyfin");
  87. }
  88. }
  89. }