20200717233541_AddDisplayPreferences.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Jellyfin.Server.Implementations.Migrations
  4. {
  5. public partial class AddDisplayPreferences : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "DisplayPreferences",
  11. schema: "jellyfin",
  12. columns: table => new
  13. {
  14. Id = table.Column<int>(nullable: false)
  15. .Annotation("Sqlite:Autoincrement", true),
  16. UserId = table.Column<Guid>(nullable: false),
  17. ItemId = table.Column<Guid>(nullable: true),
  18. Client = table.Column<string>(maxLength: 64, nullable: false),
  19. RememberIndexing = table.Column<bool>(nullable: false),
  20. RememberSorting = table.Column<bool>(nullable: false),
  21. SortOrder = table.Column<int>(nullable: false),
  22. ShowSidebar = table.Column<bool>(nullable: false),
  23. ShowBackdrop = table.Column<bool>(nullable: false),
  24. SortBy = table.Column<string>(maxLength: 64, nullable: true),
  25. ViewType = table.Column<int>(nullable: true),
  26. ScrollDirection = table.Column<int>(nullable: false),
  27. IndexBy = table.Column<int>(nullable: true),
  28. SkipForwardLength = table.Column<int>(nullable: false),
  29. SkipBackwardLength = table.Column<int>(nullable: false),
  30. ChromecastVersion = table.Column<int>(nullable: false),
  31. EnableNextVideoInfoOverlay = table.Column<bool>(nullable: false)
  32. },
  33. constraints: table =>
  34. {
  35. table.PrimaryKey("PK_DisplayPreferences", x => x.Id);
  36. table.ForeignKey(
  37. name: "FK_DisplayPreferences_Users_UserId",
  38. column: x => x.UserId,
  39. principalSchema: "jellyfin",
  40. principalTable: "Users",
  41. principalColumn: "Id",
  42. onDelete: ReferentialAction.Cascade);
  43. });
  44. migrationBuilder.CreateTable(
  45. name: "HomeSection",
  46. schema: "jellyfin",
  47. columns: table => new
  48. {
  49. Id = table.Column<int>(nullable: false)
  50. .Annotation("Sqlite:Autoincrement", true),
  51. DisplayPreferencesId = table.Column<int>(nullable: false),
  52. Order = table.Column<int>(nullable: false),
  53. Type = table.Column<int>(nullable: false)
  54. },
  55. constraints: table =>
  56. {
  57. table.PrimaryKey("PK_HomeSection", x => x.Id);
  58. table.ForeignKey(
  59. name: "FK_HomeSection_DisplayPreferences_DisplayPreferencesId",
  60. column: x => x.DisplayPreferencesId,
  61. principalSchema: "jellyfin",
  62. principalTable: "DisplayPreferences",
  63. principalColumn: "Id",
  64. onDelete: ReferentialAction.Cascade);
  65. });
  66. migrationBuilder.CreateIndex(
  67. name: "IX_DisplayPreferences_UserId",
  68. schema: "jellyfin",
  69. table: "DisplayPreferences",
  70. column: "UserId");
  71. migrationBuilder.CreateIndex(
  72. name: "IX_HomeSection_DisplayPreferencesId",
  73. schema: "jellyfin",
  74. table: "HomeSection",
  75. column: "DisplayPreferencesId");
  76. }
  77. protected override void Down(MigrationBuilder migrationBuilder)
  78. {
  79. migrationBuilder.DropTable(
  80. name: "HomeSection",
  81. schema: "jellyfin");
  82. migrationBuilder.DropTable(
  83. name: "DisplayPreferences",
  84. schema: "jellyfin");
  85. }
  86. }
  87. }