20200613202153_AddUsers.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 AddUsers : Migration
  8. {
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.CreateTable(
  12. name: "Users",
  13. schema: "jellyfin",
  14. columns: table => new
  15. {
  16. Id = table.Column<Guid>(nullable: false),
  17. Username = table.Column<string>(maxLength: 255, nullable: false),
  18. Password = table.Column<string>(maxLength: 65535, nullable: true),
  19. EasyPassword = table.Column<string>(maxLength: 65535, nullable: true),
  20. MustUpdatePassword = table.Column<bool>(nullable: false),
  21. AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: true),
  22. AuthenticationProviderId = table.Column<string>(maxLength: 255, nullable: false),
  23. PasswordResetProviderId = table.Column<string>(maxLength: 255, nullable: false),
  24. InvalidLoginAttemptCount = table.Column<int>(nullable: false),
  25. LastActivityDate = table.Column<DateTime>(nullable: true),
  26. LastLoginDate = table.Column<DateTime>(nullable: true),
  27. LoginAttemptsBeforeLockout = table.Column<int>(nullable: true),
  28. SubtitleMode = table.Column<int>(nullable: false),
  29. PlayDefaultAudioTrack = table.Column<bool>(nullable: false),
  30. SubtitleLanguagePreference = table.Column<string>(maxLength: 255, nullable: true),
  31. DisplayMissingEpisodes = table.Column<bool>(nullable: false),
  32. DisplayCollectionsView = table.Column<bool>(nullable: false),
  33. EnableLocalPassword = table.Column<bool>(nullable: false),
  34. HidePlayedInLatest = table.Column<bool>(nullable: false),
  35. RememberAudioSelections = table.Column<bool>(nullable: false),
  36. RememberSubtitleSelections = table.Column<bool>(nullable: false),
  37. EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: false),
  38. EnableAutoLogin = table.Column<bool>(nullable: false),
  39. EnableUserPreferenceAccess = table.Column<bool>(nullable: false),
  40. MaxParentalAgeRating = table.Column<int>(nullable: true),
  41. RemoteClientBitrateLimit = table.Column<int>(nullable: true),
  42. InternalId = table.Column<long>(nullable: false),
  43. SyncPlayAccess = table.Column<int>(nullable: false),
  44. RowVersion = table.Column<uint>(nullable: false)
  45. },
  46. constraints: table =>
  47. {
  48. table.PrimaryKey("PK_Users", x => x.Id);
  49. });
  50. migrationBuilder.CreateTable(
  51. name: "AccessSchedules",
  52. schema: "jellyfin",
  53. columns: table => new
  54. {
  55. Id = table.Column<int>(nullable: false)
  56. .Annotation("Sqlite:Autoincrement", true),
  57. UserId = table.Column<Guid>(nullable: false),
  58. DayOfWeek = table.Column<int>(nullable: false),
  59. StartHour = table.Column<double>(nullable: false),
  60. EndHour = table.Column<double>(nullable: false)
  61. },
  62. constraints: table =>
  63. {
  64. table.PrimaryKey("PK_AccessSchedules", x => x.Id);
  65. table.ForeignKey(
  66. name: "FK_AccessSchedules_Users_UserId",
  67. column: x => x.UserId,
  68. principalSchema: "jellyfin",
  69. principalTable: "Users",
  70. principalColumn: "Id",
  71. onDelete: ReferentialAction.Cascade);
  72. });
  73. migrationBuilder.CreateTable(
  74. name: "ImageInfos",
  75. schema: "jellyfin",
  76. columns: table => new
  77. {
  78. Id = table.Column<int>(nullable: false)
  79. .Annotation("Sqlite:Autoincrement", true),
  80. UserId = table.Column<Guid>(nullable: true),
  81. Path = table.Column<string>(maxLength: 512, nullable: false),
  82. LastModified = table.Column<DateTime>(nullable: false)
  83. },
  84. constraints: table =>
  85. {
  86. table.PrimaryKey("PK_ImageInfos", x => x.Id);
  87. table.ForeignKey(
  88. name: "FK_ImageInfos_Users_UserId",
  89. column: x => x.UserId,
  90. principalSchema: "jellyfin",
  91. principalTable: "Users",
  92. principalColumn: "Id",
  93. onDelete: ReferentialAction.Restrict);
  94. });
  95. migrationBuilder.CreateTable(
  96. name: "Permissions",
  97. schema: "jellyfin",
  98. columns: table => new
  99. {
  100. Id = table.Column<int>(nullable: false)
  101. .Annotation("Sqlite:Autoincrement", true),
  102. Kind = table.Column<int>(nullable: false),
  103. Value = table.Column<bool>(nullable: false),
  104. RowVersion = table.Column<uint>(nullable: false),
  105. Permission_Permissions_Guid = table.Column<Guid>(nullable: true)
  106. },
  107. constraints: table =>
  108. {
  109. table.PrimaryKey("PK_Permissions", x => x.Id);
  110. table.ForeignKey(
  111. name: "FK_Permissions_Users_Permission_Permissions_Guid",
  112. column: x => x.Permission_Permissions_Guid,
  113. principalSchema: "jellyfin",
  114. principalTable: "Users",
  115. principalColumn: "Id",
  116. onDelete: ReferentialAction.Restrict);
  117. });
  118. migrationBuilder.CreateTable(
  119. name: "Preferences",
  120. schema: "jellyfin",
  121. columns: table => new
  122. {
  123. Id = table.Column<int>(nullable: false)
  124. .Annotation("Sqlite:Autoincrement", true),
  125. Kind = table.Column<int>(nullable: false),
  126. Value = table.Column<string>(maxLength: 65535, nullable: false),
  127. RowVersion = table.Column<uint>(nullable: false),
  128. Preference_Preferences_Guid = table.Column<Guid>(nullable: true)
  129. },
  130. constraints: table =>
  131. {
  132. table.PrimaryKey("PK_Preferences", x => x.Id);
  133. table.ForeignKey(
  134. name: "FK_Preferences_Users_Preference_Preferences_Guid",
  135. column: x => x.Preference_Preferences_Guid,
  136. principalSchema: "jellyfin",
  137. principalTable: "Users",
  138. principalColumn: "Id",
  139. onDelete: ReferentialAction.Restrict);
  140. });
  141. migrationBuilder.CreateIndex(
  142. name: "IX_AccessSchedules_UserId",
  143. schema: "jellyfin",
  144. table: "AccessSchedules",
  145. column: "UserId");
  146. migrationBuilder.CreateIndex(
  147. name: "IX_ImageInfos_UserId",
  148. schema: "jellyfin",
  149. table: "ImageInfos",
  150. column: "UserId",
  151. unique: true);
  152. migrationBuilder.CreateIndex(
  153. name: "IX_Permissions_Permission_Permissions_Guid",
  154. schema: "jellyfin",
  155. table: "Permissions",
  156. column: "Permission_Permissions_Guid");
  157. migrationBuilder.CreateIndex(
  158. name: "IX_Preferences_Preference_Preferences_Guid",
  159. schema: "jellyfin",
  160. table: "Preferences",
  161. column: "Preference_Preferences_Guid");
  162. }
  163. protected override void Down(MigrationBuilder migrationBuilder)
  164. {
  165. migrationBuilder.DropTable(
  166. name: "AccessSchedules",
  167. schema: "jellyfin");
  168. migrationBuilder.DropTable(
  169. name: "ImageInfos",
  170. schema: "jellyfin");
  171. migrationBuilder.DropTable(
  172. name: "Permissions",
  173. schema: "jellyfin");
  174. migrationBuilder.DropTable(
  175. name: "Preferences",
  176. schema: "jellyfin");
  177. migrationBuilder.DropTable(
  178. name: "Users",
  179. schema: "jellyfin");
  180. }
  181. }
  182. }