151 lines
7.2 KiB
C#
151 lines
7.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace PlixP.Migrations
|
|
{
|
|
public partial class init : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Categories",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: true),
|
|
IsRemoved = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Categories", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Movies",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
FileName = table.Column<string>(type: "TEXT", nullable: true),
|
|
Location = table.Column<string>(type: "TEXT", nullable: true),
|
|
Quality = table.Column<string>(type: "TEXT", nullable: true),
|
|
Title = table.Column<string>(type: "TEXT", nullable: true),
|
|
Year = table.Column<string>(type: "TEXT", nullable: true),
|
|
Rated = table.Column<string>(type: "TEXT", nullable: true),
|
|
Released = table.Column<string>(type: "TEXT", nullable: true),
|
|
Runtime = table.Column<string>(type: "TEXT", nullable: true),
|
|
Genre = table.Column<string>(type: "TEXT", nullable: true),
|
|
Director = table.Column<string>(type: "TEXT", nullable: true),
|
|
Writer = table.Column<string>(type: "TEXT", nullable: true),
|
|
Actors = table.Column<string>(type: "TEXT", nullable: true),
|
|
Plot = table.Column<string>(type: "TEXT", nullable: true),
|
|
Language = table.Column<string>(type: "TEXT", nullable: true),
|
|
Country = table.Column<string>(type: "TEXT", nullable: true),
|
|
Awards = table.Column<string>(type: "TEXT", nullable: true),
|
|
Poster = table.Column<string>(type: "TEXT", nullable: true),
|
|
Metascore = table.Column<string>(type: "TEXT", nullable: true),
|
|
imdbRating = table.Column<string>(type: "TEXT", nullable: true),
|
|
imdbVotes = table.Column<string>(type: "TEXT", nullable: true),
|
|
imdbID = table.Column<string>(type: "TEXT", nullable: true),
|
|
Type = table.Column<string>(type: "TEXT", nullable: true),
|
|
DVD = table.Column<string>(type: "TEXT", nullable: true),
|
|
BoxOffice = table.Column<string>(type: "TEXT", nullable: true),
|
|
Production = table.Column<string>(type: "TEXT", nullable: true),
|
|
Website = table.Column<string>(type: "TEXT", nullable: true),
|
|
Response = table.Column<string>(type: "TEXT", nullable: true),
|
|
IsSeen = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
SyncStatus = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IsRemoved = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Movies", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "CategoryMovies",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
CategoryId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
MovieId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IsRemoved = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_CategoryMovies", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_CategoryMovies_Categories_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalTable: "Categories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_CategoryMovies_Movies_MovieId",
|
|
column: x => x.MovieId,
|
|
principalTable: "Movies",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Ratings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Source = table.Column<string>(type: "TEXT", nullable: true),
|
|
Value = table.Column<string>(type: "TEXT", nullable: true),
|
|
MovieId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IsRemoved = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Ratings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Ratings_Movies_MovieId",
|
|
column: x => x.MovieId,
|
|
principalTable: "Movies",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CategoryMovies_CategoryId",
|
|
table: "CategoryMovies",
|
|
column: "CategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CategoryMovies_MovieId",
|
|
table: "CategoryMovies",
|
|
column: "MovieId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Ratings_MovieId",
|
|
table: "Ratings",
|
|
column: "MovieId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "CategoryMovies");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Ratings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Categories");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Movies");
|
|
}
|
|
}
|
|
}
|