You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Store/Migrations/20170703134019_Initial.cs

398 lines
17 KiB

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Ombi.Store.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GlobalSettings",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Content = table.Column<string>(nullable: true),
SettingsName = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GlobalSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "NotificationTemplates",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Agent = table.Column<int>(nullable: false),
Enabled = table.Column<bool>(nullable: false),
Message = table.Column<string>(nullable: true),
NotificationType = table.Column<int>(nullable: false),
Subject = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_NotificationTemplates", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PlexContent",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AddedAt = table.Column<DateTime>(nullable: false),
Key = table.Column<string>(nullable: true),
ProviderId = table.Column<string>(nullable: true),
ReleaseYear = table.Column<string>(nullable: true),
Title = table.Column<string>(nullable: true),
Type = table.Column<int>(nullable: false),
Url = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlexContent", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RadarrCache",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TheMovieDbId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RadarrCache", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TvRequests",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ImdbId = table.Column<string>(nullable: true),
Overview = table.Column<string>(nullable: true),
PosterPath = table.Column<string>(nullable: true),
ReleaseDate = table.Column<DateTime>(nullable: false),
RootFolder = table.Column<int>(nullable: true),
Status = table.Column<string>(nullable: true),
Title = table.Column<string>(nullable: true),
TvDbId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TvRequests", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Alias = table.Column<string>(nullable: true),
ClaimsSerialized = table.Column<string>(nullable: true),
EmailAddress = table.Column<string>(nullable: true),
Password = table.Column<string>(nullable: true),
Salt = table.Column<byte[]>(nullable: true),
UserType = table.Column<int>(nullable: false),
Username = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PlexSeasonsContent",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ParentKey = table.Column<int>(nullable: false),
PlexContentId = table.Column<int>(nullable: false),
SeasonKey = table.Column<int>(nullable: false),
SeasonNumber = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlexSeasonsContent", x => x.Id);
table.ForeignKey(
name: "FK_PlexSeasonsContent_PlexContent_PlexContentId",
column: x => x.PlexContentId,
principalTable: "PlexContent",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ChildRequests",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Approved = table.Column<bool>(nullable: false),
Available = table.Column<bool>(nullable: false),
Denied = table.Column<bool>(nullable: true),
DeniedReason = table.Column<string>(nullable: true),
IssueId = table.Column<int>(nullable: true),
ParentRequestId = table.Column<int>(nullable: false),
RequestType = table.Column<int>(nullable: false),
RequestedDate = table.Column<DateTime>(nullable: false),
RequestedUserId = table.Column<int>(nullable: false),
Title = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChildRequests", x => x.Id);
table.ForeignKey(
name: "FK_ChildRequests_TvRequests_ParentRequestId",
column: x => x.ParentRequestId,
principalTable: "TvRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ChildRequests_Users_RequestedUserId",
column: x => x.RequestedUserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MovieRequests",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Approved = table.Column<bool>(nullable: false),
Available = table.Column<bool>(nullable: false),
Denied = table.Column<bool>(nullable: true),
DeniedReason = table.Column<string>(nullable: true),
ImdbId = table.Column<string>(nullable: true),
IssueId = table.Column<int>(nullable: true),
Overview = table.Column<string>(nullable: true),
PosterPath = table.Column<string>(nullable: true),
ReleaseDate = table.Column<DateTime>(nullable: false),
RequestType = table.Column<int>(nullable: false),
RequestedDate = table.Column<DateTime>(nullable: false),
RequestedUserId = table.Column<int>(nullable: false),
Status = table.Column<string>(nullable: true),
TheMovieDbId = table.Column<int>(nullable: false),
Title = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MovieRequests", x => x.Id);
table.ForeignKey(
name: "FK_MovieRequests_Users_RequestedUserId",
column: x => x.RequestedUserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TvIssues",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Description = table.Column<string>(nullable: true),
IssueId = table.Column<int>(nullable: true),
Subect = table.Column<string>(nullable: true),
TvId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TvIssues", x => x.Id);
table.ForeignKey(
name: "FK_TvIssues_ChildRequests_IssueId",
column: x => x.IssueId,
principalTable: "ChildRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TvIssues_ChildRequests_TvId",
column: x => x.TvId,
principalTable: "ChildRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SeasonRequests",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ChildRequestId = table.Column<int>(nullable: false),
SeasonNumber = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SeasonRequests", x => x.Id);
table.ForeignKey(
name: "FK_SeasonRequests_ChildRequests_ChildRequestId",
column: x => x.ChildRequestId,
principalTable: "ChildRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MovieIssues",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Description = table.Column<string>(nullable: true),
IssueId = table.Column<int>(nullable: true),
MovieId = table.Column<int>(nullable: false),
Subect = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MovieIssues", x => x.Id);
table.ForeignKey(
name: "FK_MovieIssues_MovieRequests_IssueId",
column: x => x.IssueId,
principalTable: "MovieRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MovieIssues_MovieRequests_MovieId",
column: x => x.MovieId,
principalTable: "MovieRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EpisodeRequests",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AirDate = table.Column<DateTime>(nullable: false),
Approved = table.Column<bool>(nullable: false),
Available = table.Column<bool>(nullable: false),
EpisodeNumber = table.Column<int>(nullable: false),
Requested = table.Column<bool>(nullable: false),
SeasonId = table.Column<int>(nullable: false),
Title = table.Column<string>(nullable: true),
Url = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EpisodeRequests", x => x.Id);
table.ForeignKey(
name: "FK_EpisodeRequests_SeasonRequests_SeasonId",
column: x => x.SeasonId,
principalTable: "SeasonRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PlexSeasonsContent_PlexContentId",
table: "PlexSeasonsContent",
column: "PlexContentId");
migrationBuilder.CreateIndex(
name: "IX_ChildRequests_ParentRequestId",
table: "ChildRequests",
column: "ParentRequestId");
migrationBuilder.CreateIndex(
name: "IX_ChildRequests_RequestedUserId",
table: "ChildRequests",
column: "RequestedUserId");
migrationBuilder.CreateIndex(
name: "IX_MovieIssues_IssueId",
table: "MovieIssues",
column: "IssueId");
migrationBuilder.CreateIndex(
name: "IX_MovieIssues_MovieId",
table: "MovieIssues",
column: "MovieId");
migrationBuilder.CreateIndex(
name: "IX_MovieRequests_RequestedUserId",
table: "MovieRequests",
column: "RequestedUserId");
migrationBuilder.CreateIndex(
name: "IX_TvIssues_IssueId",
table: "TvIssues",
column: "IssueId");
migrationBuilder.CreateIndex(
name: "IX_TvIssues_TvId",
table: "TvIssues",
column: "TvId");
migrationBuilder.CreateIndex(
name: "IX_EpisodeRequests_SeasonId",
table: "EpisodeRequests",
column: "SeasonId");
migrationBuilder.CreateIndex(
name: "IX_SeasonRequests_ChildRequestId",
table: "SeasonRequests",
column: "ChildRequestId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GlobalSettings");
migrationBuilder.DropTable(
name: "NotificationTemplates");
migrationBuilder.DropTable(
name: "PlexSeasonsContent");
migrationBuilder.DropTable(
name: "RadarrCache");
migrationBuilder.DropTable(
name: "MovieIssues");
migrationBuilder.DropTable(
name: "TvIssues");
migrationBuilder.DropTable(
name: "EpisodeRequests");
migrationBuilder.DropTable(
name: "PlexContent");
migrationBuilder.DropTable(
name: "MovieRequests");
migrationBuilder.DropTable(
name: "SeasonRequests");
migrationBuilder.DropTable(
name: "ChildRequests");
migrationBuilder.DropTable(
name: "TvRequests");
migrationBuilder.DropTable(
name: "Users");
}
}
}