jellyfin-server/Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.cs

299 lines
14 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
#pragma warning disable SA1601
using System;
2020-05-04 20:00:41 +00:00
using Microsoft.EntityFrameworkCore.Migrations;
namespace Jellyfin.Server.Implementations.Migrations
{
2020-05-15 21:24:01 +00:00
public partial class AddUsers : Migration
2020-05-04 20:00:41 +00:00
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
2020-05-15 21:24:01 +00:00
name: "ImageInfo",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
2020-05-27 01:20:55 +00:00
Path = table.Column<string>(maxLength: 512, nullable: false),
2020-05-15 21:24:01 +00:00
LastModified = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ImageInfo", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
schema: "jellyfin",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
2020-05-04 20:00:41 +00:00
Username = table.Column<string>(maxLength: 255, nullable: false),
Password = table.Column<string>(maxLength: 65535, nullable: true),
2020-05-15 21:24:01 +00:00
EasyPassword = table.Column<string>(maxLength: 65535, nullable: true),
2020-05-04 20:00:41 +00:00
MustUpdatePassword = table.Column<bool>(nullable: false),
2020-05-15 21:24:01 +00:00
AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: true),
2020-05-04 20:00:41 +00:00
AuthenticationProviderId = table.Column<string>(maxLength: 255, nullable: false),
2020-05-15 21:24:01 +00:00
PasswordResetProviderId = table.Column<string>(maxLength: 255, nullable: false),
2020-05-04 20:00:41 +00:00
InvalidLoginAttemptCount = table.Column<int>(nullable: false),
LastActivityDate = table.Column<DateTime>(nullable: true),
LastLoginDate = table.Column<DateTime>(nullable: true),
2020-05-04 20:00:41 +00:00
LoginAttemptsBeforeLockout = table.Column<int>(nullable: true),
2020-05-15 21:24:01 +00:00
SubtitleMode = table.Column<int>(nullable: false),
2020-05-04 20:00:41 +00:00
PlayDefaultAudioTrack = table.Column<bool>(nullable: false),
2020-05-15 21:24:01 +00:00
SubtitleLanguagePreference = table.Column<string>(maxLength: 255, nullable: true),
DisplayMissingEpisodes = table.Column<bool>(nullable: false),
DisplayCollectionsView = table.Column<bool>(nullable: false),
EnableLocalPassword = table.Column<bool>(nullable: false),
HidePlayedInLatest = table.Column<bool>(nullable: false),
RememberAudioSelections = table.Column<bool>(nullable: false),
RememberSubtitleSelections = table.Column<bool>(nullable: false),
EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: false),
EnableAutoLogin = table.Column<bool>(nullable: false),
EnableUserPreferenceAccess = table.Column<bool>(nullable: false),
MaxParentalAgeRating = table.Column<int>(nullable: true),
RemoteClientBitrateLimit = table.Column<int>(nullable: true),
InternalId = table.Column<long>(nullable: false),
ProfileImageId = table.Column<int>(nullable: true),
2020-05-27 01:20:55 +00:00
SyncPlayAccess = table.Column<int>(nullable: false),
2020-05-04 20:00:41 +00:00
RowVersion = table.Column<uint>(nullable: false)
},
constraints: table =>
{
2020-05-15 21:24:01 +00:00
table.PrimaryKey("PK_Users", x => x.Id);
table.ForeignKey(
name: "FK_Users_ImageInfo_ProfileImageId",
column: x => x.ProfileImageId,
principalSchema: "jellyfin",
principalTable: "ImageInfo",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
2020-05-04 20:00:41 +00:00
});
migrationBuilder.CreateTable(
2020-05-15 21:24:01 +00:00
name: "AccessSchedule",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
2020-05-15 21:24:01 +00:00
UserId = table.Column<Guid>(nullable: false),
DayOfWeek = table.Column<int>(nullable: false),
StartHour = table.Column<double>(nullable: false),
EndHour = table.Column<double>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AccessSchedule", x => x.Id);
table.ForeignKey(
name: "FK_AccessSchedule_Users_UserId",
column: x => x.UserId,
principalSchema: "jellyfin",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Groups",
schema: "jellyfin",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
2020-05-04 20:00:41 +00:00
Name = table.Column<string>(maxLength: 255, nullable: false),
RowVersion = table.Column<uint>(nullable: false),
2020-05-15 21:24:01 +00:00
Group_Groups_Guid = table.Column<Guid>(nullable: true)
2020-05-04 20:00:41 +00:00
},
constraints: table =>
{
2020-05-15 21:24:01 +00:00
table.PrimaryKey("PK_Groups", x => x.Id);
2020-05-04 20:00:41 +00:00
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_Groups_Users_Group_Groups_Guid",
column: x => x.Group_Groups_Guid,
2020-05-04 20:00:41 +00:00
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Users",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
2020-05-15 21:24:01 +00:00
name: "Permissions",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Kind = table.Column<int>(nullable: false),
Value = table.Column<bool>(nullable: false),
RowVersion = table.Column<uint>(nullable: false),
2020-05-15 21:24:01 +00:00
Permission_GroupPermissions_Id = table.Column<Guid>(nullable: true),
Permission_Permissions_Guid = table.Column<Guid>(nullable: true)
2020-05-04 20:00:41 +00:00
},
constraints: table =>
{
2020-05-15 21:24:01 +00:00
table.PrimaryKey("PK_Permissions", x => x.Id);
2020-05-04 20:00:41 +00:00
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_Permissions_Groups_Permission_GroupPermissions_Id",
2020-05-04 20:00:41 +00:00
column: x => x.Permission_GroupPermissions_Id,
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Groups",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_Permissions_Users_Permission_Permissions_Guid",
column: x => x.Permission_Permissions_Guid,
2020-05-04 20:00:41 +00:00
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Users",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
2020-05-15 21:24:01 +00:00
name: "Preferences",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Kind = table.Column<int>(nullable: false),
Value = table.Column<string>(maxLength: 65535, nullable: false),
RowVersion = table.Column<uint>(nullable: false),
2020-05-15 21:24:01 +00:00
Preference_Preferences_Guid = table.Column<Guid>(nullable: true),
Preference_Preferences_Id = table.Column<Guid>(nullable: true)
2020-05-04 20:00:41 +00:00
},
constraints: table =>
{
2020-05-15 21:24:01 +00:00
table.PrimaryKey("PK_Preferences", x => x.Id);
2020-05-04 20:00:41 +00:00
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_Preferences_Users_Preference_Preferences_Guid",
column: x => x.Preference_Preferences_Guid,
2020-05-04 20:00:41 +00:00
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Users",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_Preferences_Groups_Preference_Preferences_Id",
2020-05-04 20:00:41 +00:00
column: x => x.Preference_Preferences_Id,
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Groups",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ProviderMapping",
schema: "jellyfin",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProviderName = table.Column<string>(maxLength: 255, nullable: false),
ProviderSecrets = table.Column<string>(maxLength: 65535, nullable: false),
ProviderData = table.Column<string>(maxLength: 65535, nullable: false),
RowVersion = table.Column<uint>(nullable: false),
2020-05-15 21:24:01 +00:00
ProviderMapping_ProviderMappings_Id = table.Column<Guid>(nullable: true)
2020-05-04 20:00:41 +00:00
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderMapping", x => x.Id);
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_ProviderMapping_Groups_ProviderMapping_ProviderMappings_Id",
2020-05-04 20:00:41 +00:00
column: x => x.ProviderMapping_ProviderMappings_Id,
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Groups",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
2020-05-15 21:24:01 +00:00
name: "FK_ProviderMapping_Users_ProviderMapping_ProviderMappings_Id",
2020-05-04 20:00:41 +00:00
column: x => x.ProviderMapping_ProviderMappings_Id,
principalSchema: "jellyfin",
2020-05-15 21:24:01 +00:00
principalTable: "Users",
2020-05-04 20:00:41 +00:00
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
2020-05-15 21:24:01 +00:00
name: "IX_AccessSchedule_UserId",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
2020-05-15 21:24:01 +00:00
table: "AccessSchedule",
column: "UserId");
2020-05-04 20:00:41 +00:00
migrationBuilder.CreateIndex(
2020-05-15 21:24:01 +00:00
name: "IX_Groups_Group_Groups_Guid",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
2020-05-15 21:24:01 +00:00
table: "Groups",
column: "Group_Groups_Guid");
migrationBuilder.CreateIndex(
name: "IX_Permissions_Permission_GroupPermissions_Id",
schema: "jellyfin",
table: "Permissions",
2020-05-04 20:00:41 +00:00
column: "Permission_GroupPermissions_Id");
migrationBuilder.CreateIndex(
2020-05-15 21:24:01 +00:00
name: "IX_Permissions_Permission_Permissions_Guid",
schema: "jellyfin",
table: "Permissions",
column: "Permission_Permissions_Guid");
migrationBuilder.CreateIndex(
name: "IX_Preferences_Preference_Preferences_Guid",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
2020-05-15 21:24:01 +00:00
table: "Preferences",
column: "Preference_Preferences_Guid");
2020-05-04 20:00:41 +00:00
migrationBuilder.CreateIndex(
2020-05-15 21:24:01 +00:00
name: "IX_Preferences_Preference_Preferences_Id",
2020-05-04 20:00:41 +00:00
schema: "jellyfin",
2020-05-15 21:24:01 +00:00
table: "Preferences",
2020-05-04 20:00:41 +00:00
column: "Preference_Preferences_Id");
migrationBuilder.CreateIndex(
name: "IX_ProviderMapping_ProviderMapping_ProviderMappings_Id",
schema: "jellyfin",
table: "ProviderMapping",
column: "ProviderMapping_ProviderMappings_Id");
2020-05-15 21:24:01 +00:00
migrationBuilder.CreateIndex(
name: "IX_Users_ProfileImageId",
schema: "jellyfin",
table: "Users",
column: "ProfileImageId");
2020-05-04 20:00:41 +00:00
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
2020-05-15 21:24:01 +00:00
name: "AccessSchedule",
schema: "jellyfin");
migrationBuilder.DropTable(
name: "Permissions",
2020-05-04 20:00:41 +00:00
schema: "jellyfin");
migrationBuilder.DropTable(
2020-05-15 21:24:01 +00:00
name: "Preferences",
2020-05-04 20:00:41 +00:00
schema: "jellyfin");
migrationBuilder.DropTable(
name: "ProviderMapping",
schema: "jellyfin");
migrationBuilder.DropTable(
2020-05-15 21:24:01 +00:00
name: "Groups",
schema: "jellyfin");
migrationBuilder.DropTable(
name: "Users",
2020-05-04 20:00:41 +00:00
schema: "jellyfin");
migrationBuilder.DropTable(
2020-05-15 21:24:01 +00:00
name: "ImageInfo",
2020-05-04 20:00:41 +00:00
schema: "jellyfin");
}
}
}