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(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: true), IsRemoved = table.Column(type: "INTEGER", nullable: false), CreationDate = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Categories", x => x.Id); }); migrationBuilder.CreateTable( name: "Movies", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), FileName = table.Column(type: "TEXT", nullable: true), Location = table.Column(type: "TEXT", nullable: true), Quality = table.Column(type: "TEXT", nullable: true), Title = table.Column(type: "TEXT", nullable: true), Year = table.Column(type: "TEXT", nullable: true), Rated = table.Column(type: "TEXT", nullable: true), Released = table.Column(type: "TEXT", nullable: true), Runtime = table.Column(type: "TEXT", nullable: true), Genre = table.Column(type: "TEXT", nullable: true), Director = table.Column(type: "TEXT", nullable: true), Writer = table.Column(type: "TEXT", nullable: true), Actors = table.Column(type: "TEXT", nullable: true), Plot = table.Column(type: "TEXT", nullable: true), Language = table.Column(type: "TEXT", nullable: true), Country = table.Column(type: "TEXT", nullable: true), Awards = table.Column(type: "TEXT", nullable: true), Poster = table.Column(type: "TEXT", nullable: true), Metascore = table.Column(type: "TEXT", nullable: true), imdbRating = table.Column(type: "TEXT", nullable: true), imdbVotes = table.Column(type: "TEXT", nullable: true), imdbID = table.Column(type: "TEXT", nullable: true), Type = table.Column(type: "TEXT", nullable: true), DVD = table.Column(type: "TEXT", nullable: true), BoxOffice = table.Column(type: "TEXT", nullable: true), Production = table.Column(type: "TEXT", nullable: true), Website = table.Column(type: "TEXT", nullable: true), Response = table.Column(type: "TEXT", nullable: true), IsSeen = table.Column(type: "INTEGER", nullable: false), SyncStatus = table.Column(type: "INTEGER", nullable: false), IsRemoved = table.Column(type: "INTEGER", nullable: false), CreationDate = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Movies", x => x.Id); }); migrationBuilder.CreateTable( name: "CategoryMovies", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), CategoryId = table.Column(type: "INTEGER", nullable: false), MovieId = table.Column(type: "INTEGER", nullable: false), IsRemoved = table.Column(type: "INTEGER", nullable: false), CreationDate = table.Column(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(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Source = table.Column(type: "TEXT", nullable: true), Value = table.Column(type: "TEXT", nullable: true), MovieId = table.Column(type: "INTEGER", nullable: false), IsRemoved = table.Column(type: "INTEGER", nullable: false), CreationDate = table.Column(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"); } } }