20201204223655_AddCustomDisplayPreferences.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #pragma warning disable CS1591
  2. // <auto-generated />
  3. using System;
  4. using Microsoft.EntityFrameworkCore.Migrations;
  5. namespace Jellyfin.Server.Implementations.Migrations
  6. {
  7. public partial class AddCustomDisplayPreferences : Migration
  8. {
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.DropIndex(
  12. name: "IX_DisplayPreferences_UserId_Client",
  13. schema: "jellyfin",
  14. table: "DisplayPreferences");
  15. migrationBuilder.AlterColumn<int>(
  16. name: "MaxActiveSessions",
  17. schema: "jellyfin",
  18. table: "Users",
  19. type: "INTEGER",
  20. nullable: false,
  21. defaultValue: 0,
  22. oldClrType: typeof(int),
  23. oldType: "INTEGER",
  24. oldNullable: true);
  25. migrationBuilder.AddColumn<Guid>(
  26. name: "ItemId",
  27. schema: "jellyfin",
  28. table: "DisplayPreferences",
  29. type: "TEXT",
  30. nullable: false,
  31. defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
  32. migrationBuilder.CreateTable(
  33. name: "CustomItemDisplayPreferences",
  34. schema: "jellyfin",
  35. columns: table => new
  36. {
  37. Id = table.Column<int>(type: "INTEGER", nullable: false)
  38. .Annotation("Sqlite:Autoincrement", true),
  39. UserId = table.Column<Guid>(type: "TEXT", nullable: false),
  40. ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
  41. Client = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
  42. Key = table.Column<string>(type: "TEXT", nullable: false),
  43. Value = table.Column<string>(type: "TEXT", nullable: false)
  44. },
  45. constraints: table =>
  46. {
  47. table.PrimaryKey("PK_CustomItemDisplayPreferences", x => x.Id);
  48. });
  49. migrationBuilder.CreateIndex(
  50. name: "IX_DisplayPreferences_UserId_ItemId_Client",
  51. schema: "jellyfin",
  52. table: "DisplayPreferences",
  53. columns: new[] { "UserId", "ItemId", "Client" },
  54. unique: true);
  55. migrationBuilder.CreateIndex(
  56. name: "IX_CustomItemDisplayPreferences_UserId",
  57. schema: "jellyfin",
  58. table: "CustomItemDisplayPreferences",
  59. column: "UserId");
  60. migrationBuilder.CreateIndex(
  61. name: "IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key",
  62. schema: "jellyfin",
  63. table: "CustomItemDisplayPreferences",
  64. columns: new[] { "UserId", "ItemId", "Client", "Key" },
  65. unique: true);
  66. }
  67. protected override void Down(MigrationBuilder migrationBuilder)
  68. {
  69. migrationBuilder.DropTable(
  70. name: "CustomItemDisplayPreferences",
  71. schema: "jellyfin");
  72. migrationBuilder.DropIndex(
  73. name: "IX_DisplayPreferences_UserId_ItemId_Client",
  74. schema: "jellyfin",
  75. table: "DisplayPreferences");
  76. migrationBuilder.DropColumn(
  77. name: "ItemId",
  78. schema: "jellyfin",
  79. table: "DisplayPreferences");
  80. migrationBuilder.AlterColumn<int>(
  81. name: "MaxActiveSessions",
  82. schema: "jellyfin",
  83. table: "Users",
  84. type: "INTEGER",
  85. nullable: true,
  86. oldClrType: typeof(int),
  87. oldType: "INTEGER");
  88. migrationBuilder.CreateIndex(
  89. name: "IX_DisplayPreferences_UserId_Client",
  90. schema: "jellyfin",
  91. table: "DisplayPreferences",
  92. columns: new[] { "UserId", "Client" },
  93. unique: true);
  94. }
  95. }
  96. }