20200630170339_AddDisplayPreferences.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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>(nullable: true),
  27. ViewType = table.Column<int>(nullable: true),
  28. ScrollDirection = table.Column<int>(nullable: false),
  29. IndexBy = table.Column<int>(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: "HomeSection",
  44. schema: "jellyfin",
  45. columns: table => new
  46. {
  47. Id = table.Column<int>(nullable: false)
  48. .Annotation("Sqlite:Autoincrement", true),
  49. DisplayPreferencesId = table.Column<int>(nullable: false),
  50. Order = table.Column<int>(nullable: false),
  51. Type = table.Column<int>(nullable: false)
  52. },
  53. constraints: table =>
  54. {
  55. table.PrimaryKey("PK_HomeSection", x => x.Id);
  56. table.ForeignKey(
  57. name: "FK_HomeSection_DisplayPreferences_DisplayPreferencesId",
  58. column: x => x.DisplayPreferencesId,
  59. principalSchema: "jellyfin",
  60. principalTable: "DisplayPreferences",
  61. principalColumn: "Id",
  62. onDelete: ReferentialAction.Cascade);
  63. });
  64. migrationBuilder.CreateIndex(
  65. name: "IX_DisplayPreferences_UserId",
  66. schema: "jellyfin",
  67. table: "DisplayPreferences",
  68. column: "UserId");
  69. migrationBuilder.CreateIndex(
  70. name: "IX_HomeSection_DisplayPreferencesId",
  71. schema: "jellyfin",
  72. table: "HomeSection",
  73. column: "DisplayPreferencesId");
  74. }
  75. protected override void Down(MigrationBuilder migrationBuilder)
  76. {
  77. migrationBuilder.DropTable(
  78. name: "HomeSection",
  79. schema: "jellyfin");
  80. migrationBuilder.DropTable(
  81. name: "DisplayPreferences",
  82. schema: "jellyfin");
  83. }
  84. }
  85. }