20200504195702_UserSchema.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #pragma warning disable CS1591
  2. #pragma warning disable SA1601
  3. using Microsoft.EntityFrameworkCore.Migrations;
  4. namespace Jellyfin.Server.Implementations.Migrations
  5. {
  6. public partial class UserSchema : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "User",
  12. schema: "jellyfin",
  13. columns: table => new
  14. {
  15. Id = table.Column<int>(nullable: false)
  16. .Annotation("Sqlite:Autoincrement", true),
  17. Username = table.Column<string>(maxLength: 255, nullable: false),
  18. Password = table.Column<string>(maxLength: 65535, nullable: true),
  19. MustUpdatePassword = table.Column<bool>(nullable: false),
  20. AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: false),
  21. AuthenticationProviderId = table.Column<string>(maxLength: 255, nullable: false),
  22. GroupedFolders = table.Column<string>(maxLength: 65535, nullable: true),
  23. InvalidLoginAttemptCount = table.Column<int>(nullable: false),
  24. LatestItemExcludes = table.Column<string>(maxLength: 65535, nullable: true),
  25. LoginAttemptsBeforeLockout = table.Column<int>(nullable: true),
  26. MyMediaExcludes = table.Column<string>(maxLength: 65535, nullable: true),
  27. OrderedViews = table.Column<string>(maxLength: 65535, nullable: true),
  28. SubtitleMode = table.Column<string>(maxLength: 255, nullable: false),
  29. PlayDefaultAudioTrack = table.Column<bool>(nullable: false),
  30. SubtitleLanguagePrefernce = table.Column<string>(maxLength: 255, nullable: true),
  31. DisplayMissingEpisodes = table.Column<bool>(nullable: true),
  32. DisplayCollectionsView = table.Column<bool>(nullable: true),
  33. HidePlayedInLatest = table.Column<bool>(nullable: true),
  34. RememberAudioSelections = table.Column<bool>(nullable: true),
  35. RememberSubtitleSelections = table.Column<bool>(nullable: true),
  36. EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: true),
  37. EnableUserPreferenceAccess = table.Column<bool>(nullable: true),
  38. RowVersion = table.Column<uint>(nullable: false)
  39. },
  40. constraints: table =>
  41. {
  42. table.PrimaryKey("PK_User", x => x.Id);
  43. });
  44. migrationBuilder.CreateTable(
  45. name: "Group",
  46. schema: "jellyfin",
  47. columns: table => new
  48. {
  49. Id = table.Column<int>(nullable: false)
  50. .Annotation("Sqlite:Autoincrement", true),
  51. Name = table.Column<string>(maxLength: 255, nullable: false),
  52. RowVersion = table.Column<uint>(nullable: false),
  53. Group_Groups_Id = table.Column<int>(nullable: true)
  54. },
  55. constraints: table =>
  56. {
  57. table.PrimaryKey("PK_Group", x => x.Id);
  58. table.ForeignKey(
  59. name: "FK_Group_User_Group_Groups_Id",
  60. column: x => x.Group_Groups_Id,
  61. principalSchema: "jellyfin",
  62. principalTable: "User",
  63. principalColumn: "Id",
  64. onDelete: ReferentialAction.Restrict);
  65. });
  66. migrationBuilder.CreateTable(
  67. name: "Permission",
  68. schema: "jellyfin",
  69. columns: table => new
  70. {
  71. Id = table.Column<int>(nullable: false)
  72. .Annotation("Sqlite:Autoincrement", true),
  73. Kind = table.Column<int>(nullable: false),
  74. Value = table.Column<bool>(nullable: false),
  75. RowVersion = table.Column<uint>(nullable: false),
  76. Permission_GroupPermissions_Id = table.Column<int>(nullable: true),
  77. Permission_Permissions_Id = table.Column<int>(nullable: true)
  78. },
  79. constraints: table =>
  80. {
  81. table.PrimaryKey("PK_Permission", x => x.Id);
  82. table.ForeignKey(
  83. name: "FK_Permission_Group_Permission_GroupPermissions_Id",
  84. column: x => x.Permission_GroupPermissions_Id,
  85. principalSchema: "jellyfin",
  86. principalTable: "Group",
  87. principalColumn: "Id",
  88. onDelete: ReferentialAction.Restrict);
  89. table.ForeignKey(
  90. name: "FK_Permission_User_Permission_Permissions_Id",
  91. column: x => x.Permission_Permissions_Id,
  92. principalSchema: "jellyfin",
  93. principalTable: "User",
  94. principalColumn: "Id",
  95. onDelete: ReferentialAction.Restrict);
  96. });
  97. migrationBuilder.CreateTable(
  98. name: "Preference",
  99. schema: "jellyfin",
  100. columns: table => new
  101. {
  102. Id = table.Column<int>(nullable: false)
  103. .Annotation("Sqlite:Autoincrement", true),
  104. Kind = table.Column<int>(nullable: false),
  105. Value = table.Column<string>(maxLength: 65535, nullable: false),
  106. RowVersion = table.Column<uint>(nullable: false),
  107. Preference_Preferences_Id = table.Column<int>(nullable: true)
  108. },
  109. constraints: table =>
  110. {
  111. table.PrimaryKey("PK_Preference", x => x.Id);
  112. table.ForeignKey(
  113. name: "FK_Preference_Group_Preference_Preferences_Id",
  114. column: x => x.Preference_Preferences_Id,
  115. principalSchema: "jellyfin",
  116. principalTable: "Group",
  117. principalColumn: "Id",
  118. onDelete: ReferentialAction.Restrict);
  119. table.ForeignKey(
  120. name: "FK_Preference_User_Preference_Preferences_Id",
  121. column: x => x.Preference_Preferences_Id,
  122. principalSchema: "jellyfin",
  123. principalTable: "User",
  124. principalColumn: "Id",
  125. onDelete: ReferentialAction.Restrict);
  126. });
  127. migrationBuilder.CreateTable(
  128. name: "ProviderMapping",
  129. schema: "jellyfin",
  130. columns: table => new
  131. {
  132. Id = table.Column<int>(nullable: false)
  133. .Annotation("Sqlite:Autoincrement", true),
  134. ProviderName = table.Column<string>(maxLength: 255, nullable: false),
  135. ProviderSecrets = table.Column<string>(maxLength: 65535, nullable: false),
  136. ProviderData = table.Column<string>(maxLength: 65535, nullable: false),
  137. RowVersion = table.Column<uint>(nullable: false),
  138. ProviderMapping_ProviderMappings_Id = table.Column<int>(nullable: true)
  139. },
  140. constraints: table =>
  141. {
  142. table.PrimaryKey("PK_ProviderMapping", x => x.Id);
  143. table.ForeignKey(
  144. name: "FK_ProviderMapping_Group_ProviderMapping_ProviderMappings_Id",
  145. column: x => x.ProviderMapping_ProviderMappings_Id,
  146. principalSchema: "jellyfin",
  147. principalTable: "Group",
  148. principalColumn: "Id",
  149. onDelete: ReferentialAction.Restrict);
  150. table.ForeignKey(
  151. name: "FK_ProviderMapping_User_ProviderMapping_ProviderMappings_Id",
  152. column: x => x.ProviderMapping_ProviderMappings_Id,
  153. principalSchema: "jellyfin",
  154. principalTable: "User",
  155. principalColumn: "Id",
  156. onDelete: ReferentialAction.Restrict);
  157. });
  158. migrationBuilder.CreateIndex(
  159. name: "IX_Group_Group_Groups_Id",
  160. schema: "jellyfin",
  161. table: "Group",
  162. column: "Group_Groups_Id");
  163. migrationBuilder.CreateIndex(
  164. name: "IX_Permission_Permission_GroupPermissions_Id",
  165. schema: "jellyfin",
  166. table: "Permission",
  167. column: "Permission_GroupPermissions_Id");
  168. migrationBuilder.CreateIndex(
  169. name: "IX_Permission_Permission_Permissions_Id",
  170. schema: "jellyfin",
  171. table: "Permission",
  172. column: "Permission_Permissions_Id");
  173. migrationBuilder.CreateIndex(
  174. name: "IX_Preference_Preference_Preferences_Id",
  175. schema: "jellyfin",
  176. table: "Preference",
  177. column: "Preference_Preferences_Id");
  178. migrationBuilder.CreateIndex(
  179. name: "IX_ProviderMapping_ProviderMapping_ProviderMappings_Id",
  180. schema: "jellyfin",
  181. table: "ProviderMapping",
  182. column: "ProviderMapping_ProviderMappings_Id");
  183. }
  184. protected override void Down(MigrationBuilder migrationBuilder)
  185. {
  186. migrationBuilder.DropTable(
  187. name: "Permission",
  188. schema: "jellyfin");
  189. migrationBuilder.DropTable(
  190. name: "Preference",
  191. schema: "jellyfin");
  192. migrationBuilder.DropTable(
  193. name: "ProviderMapping",
  194. schema: "jellyfin");
  195. migrationBuilder.DropTable(
  196. name: "Group",
  197. schema: "jellyfin");
  198. migrationBuilder.DropTable(
  199. name: "User",
  200. schema: "jellyfin");
  201. }
  202. }
  203. }