20240907123425_UserDataInJfLib.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Jellyfin.Server.Implementations.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class UserDataInJfLib : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "UserData",
  14. columns: table => new
  15. {
  16. Key = table.Column<string>(type: "TEXT", nullable: false),
  17. Rating = table.Column<double>(type: "REAL", nullable: true),
  18. PlaybackPositionTicks = table.Column<long>(type: "INTEGER", nullable: false),
  19. PlayCount = table.Column<int>(type: "INTEGER", nullable: false),
  20. IsFavorite = table.Column<bool>(type: "INTEGER", nullable: false),
  21. LastPlayedDate = table.Column<DateTime>(type: "TEXT", nullable: true),
  22. Played = table.Column<bool>(type: "INTEGER", nullable: false),
  23. AudioStreamIndex = table.Column<int>(type: "INTEGER", nullable: true),
  24. SubtitleStreamIndex = table.Column<int>(type: "INTEGER", nullable: true),
  25. Likes = table.Column<bool>(type: "INTEGER", nullable: true),
  26. UserId = table.Column<Guid>(type: "TEXT", nullable: false)
  27. },
  28. constraints: table =>
  29. {
  30. table.ForeignKey(
  31. name: "FK_UserData_Users_UserId",
  32. column: x => x.UserId,
  33. principalTable: "Users",
  34. principalColumn: "Id",
  35. onDelete: ReferentialAction.Cascade);
  36. });
  37. migrationBuilder.CreateIndex(
  38. name: "IX_UserData_Key_UserId",
  39. table: "UserData",
  40. columns: new[] { "Key", "UserId" },
  41. unique: true);
  42. migrationBuilder.CreateIndex(
  43. name: "IX_UserData_Key_UserId_IsFavorite",
  44. table: "UserData",
  45. columns: new[] { "Key", "UserId", "IsFavorite" });
  46. migrationBuilder.CreateIndex(
  47. name: "IX_UserData_Key_UserId_LastPlayedDate",
  48. table: "UserData",
  49. columns: new[] { "Key", "UserId", "LastPlayedDate" });
  50. migrationBuilder.CreateIndex(
  51. name: "IX_UserData_Key_UserId_PlaybackPositionTicks",
  52. table: "UserData",
  53. columns: new[] { "Key", "UserId", "PlaybackPositionTicks" });
  54. migrationBuilder.CreateIndex(
  55. name: "IX_UserData_Key_UserId_Played",
  56. table: "UserData",
  57. columns: new[] { "Key", "UserId", "Played" });
  58. migrationBuilder.CreateIndex(
  59. name: "IX_UserData_UserId",
  60. table: "UserData",
  61. column: "UserId");
  62. }
  63. /// <inheritdoc />
  64. protected override void Down(MigrationBuilder migrationBuilder)
  65. {
  66. migrationBuilder.DropTable(
  67. name: "UserData");
  68. }
  69. }
  70. }