20200531020729_AddUsers.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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: "ImageInfo",
  13. schema: "jellyfin",
  14. columns: table => new
  15. {
  16. Id = table.Column<int>(nullable: false)
  17. .Annotation("Sqlite:Autoincrement", true),
  18. Path = table.Column<string>(maxLength: 512, nullable: false),
  19. LastModified = table.Column<DateTime>(nullable: false)
  20. },
  21. constraints: table =>
  22. {
  23. table.PrimaryKey("PK_ImageInfo", x => x.Id);
  24. });
  25. migrationBuilder.CreateTable(
  26. name: "Users",
  27. schema: "jellyfin",
  28. columns: table => new
  29. {
  30. Id = table.Column<Guid>(nullable: false),
  31. Username = table.Column<string>(maxLength: 255, nullable: false),
  32. Password = table.Column<string>(maxLength: 65535, nullable: true),
  33. EasyPassword = table.Column<string>(maxLength: 65535, nullable: true),
  34. MustUpdatePassword = table.Column<bool>(nullable: false),
  35. AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: true),
  36. AuthenticationProviderId = table.Column<string>(maxLength: 255, nullable: false),
  37. PasswordResetProviderId = table.Column<string>(maxLength: 255, nullable: false),
  38. InvalidLoginAttemptCount = table.Column<int>(nullable: false),
  39. LastActivityDate = table.Column<DateTime>(nullable: true),
  40. LastLoginDate = table.Column<DateTime>(nullable: true),
  41. LoginAttemptsBeforeLockout = table.Column<int>(nullable: true),
  42. SubtitleMode = table.Column<int>(nullable: false),
  43. PlayDefaultAudioTrack = table.Column<bool>(nullable: false),
  44. SubtitleLanguagePreference = table.Column<string>(maxLength: 255, nullable: true),
  45. DisplayMissingEpisodes = table.Column<bool>(nullable: false),
  46. DisplayCollectionsView = table.Column<bool>(nullable: false),
  47. EnableLocalPassword = table.Column<bool>(nullable: false),
  48. HidePlayedInLatest = table.Column<bool>(nullable: false),
  49. RememberAudioSelections = table.Column<bool>(nullable: false),
  50. RememberSubtitleSelections = table.Column<bool>(nullable: false),
  51. EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: false),
  52. EnableAutoLogin = table.Column<bool>(nullable: false),
  53. EnableUserPreferenceAccess = table.Column<bool>(nullable: false),
  54. MaxParentalAgeRating = table.Column<int>(nullable: true),
  55. RemoteClientBitrateLimit = table.Column<int>(nullable: true),
  56. InternalId = table.Column<long>(nullable: false),
  57. ProfileImageId = table.Column<int>(nullable: true),
  58. SyncPlayAccess = table.Column<int>(nullable: false),
  59. RowVersion = table.Column<uint>(nullable: false)
  60. },
  61. constraints: table =>
  62. {
  63. table.PrimaryKey("PK_Users", x => x.Id);
  64. table.ForeignKey(
  65. name: "FK_Users_ImageInfo_ProfileImageId",
  66. column: x => x.ProfileImageId,
  67. principalSchema: "jellyfin",
  68. principalTable: "ImageInfo",
  69. principalColumn: "Id",
  70. onDelete: ReferentialAction.Restrict);
  71. });
  72. migrationBuilder.CreateTable(
  73. name: "AccessSchedule",
  74. schema: "jellyfin",
  75. columns: table => new
  76. {
  77. Id = table.Column<int>(nullable: false)
  78. .Annotation("Sqlite:Autoincrement", true),
  79. UserId = table.Column<Guid>(nullable: false),
  80. DayOfWeek = table.Column<int>(nullable: false),
  81. StartHour = table.Column<double>(nullable: false),
  82. EndHour = table.Column<double>(nullable: false)
  83. },
  84. constraints: table =>
  85. {
  86. table.PrimaryKey("PK_AccessSchedule", x => x.Id);
  87. table.ForeignKey(
  88. name: "FK_AccessSchedule_Users_UserId",
  89. column: x => x.UserId,
  90. principalSchema: "jellyfin",
  91. principalTable: "Users",
  92. principalColumn: "Id",
  93. onDelete: ReferentialAction.Cascade);
  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_AccessSchedule_UserId",
  143. schema: "jellyfin",
  144. table: "AccessSchedule",
  145. column: "UserId");
  146. migrationBuilder.CreateIndex(
  147. name: "IX_Permissions_Permission_Permissions_Guid",
  148. schema: "jellyfin",
  149. table: "Permissions",
  150. column: "Permission_Permissions_Guid");
  151. migrationBuilder.CreateIndex(
  152. name: "IX_Preferences_Preference_Preferences_Guid",
  153. schema: "jellyfin",
  154. table: "Preferences",
  155. column: "Preference_Preferences_Guid");
  156. migrationBuilder.CreateIndex(
  157. name: "IX_Users_ProfileImageId",
  158. schema: "jellyfin",
  159. table: "Users",
  160. column: "ProfileImageId");
  161. }
  162. protected override void Down(MigrationBuilder migrationBuilder)
  163. {
  164. migrationBuilder.DropTable(
  165. name: "AccessSchedule",
  166. schema: "jellyfin");
  167. migrationBuilder.DropTable(
  168. name: "Permissions",
  169. schema: "jellyfin");
  170. migrationBuilder.DropTable(
  171. name: "Preferences",
  172. schema: "jellyfin");
  173. migrationBuilder.DropTable(
  174. name: "Users",
  175. schema: "jellyfin");
  176. migrationBuilder.DropTable(
  177. name: "ImageInfo",
  178. schema: "jellyfin");
  179. }
  180. }
  181. }