using System; using Microsoft.EntityFrameworkCore.Migrations; namespace RMuseum.Migrations { public partial class Recitations : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "GanjoorPoets", columns: table => new { Id = table.Column(nullable: false), Name = table.Column(nullable: true), Description = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_GanjoorPoets", x => x.Id); }); migrationBuilder.CreateTable( name: "Recitations", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OwnerId = table.Column(nullable: false), GanjoorAudioId = table.Column(nullable: false), GanjoorPostId = table.Column(nullable: false), AudioOrder = table.Column(nullable: false), FileNameWithoutExtension = table.Column(nullable: true), SoundFilesFolder = table.Column(nullable: true), AudioTitle = table.Column(nullable: true), AudioArtist = table.Column(nullable: true), AudioArtistUrl = table.Column(nullable: true), AudioSrc = table.Column(nullable: true), AudioSrcUrl = table.Column(nullable: true), LegacyAudioGuid = table.Column(nullable: false), Mp3FileCheckSum = table.Column(nullable: true), Mp3SizeInBytes = table.Column(nullable: false), OggSizeInBytes = table.Column(nullable: false), UploadDate = table.Column(nullable: false), FileLastUpdated = table.Column(nullable: false), ReviewDate = table.Column(nullable: false), LocalMp3FilePath = table.Column(nullable: true), LocalXmlFilePath = table.Column(nullable: true), AudioSyncStatus = table.Column(nullable: false), ReviewStatus = table.Column(nullable: false), ReviewerId = table.Column(nullable: true), ReviewMsg = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Recitations", x => x.Id); table.ForeignKey( name: "FK_Recitations_AspNetUsers_OwnerId", column: x => x.OwnerId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Recitations_AspNetUsers_ReviewerId", column: x => x.ReviewerId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "UploadSessions", columns: table => new { Id = table.Column(nullable: false), SessionType = table.Column(nullable: false), UserId = table.Column(nullable: true), UseId = table.Column(nullable: false), UploadStartTime = table.Column(nullable: false), UploadEndTime = table.Column(nullable: false), ProcessStartTime = table.Column(nullable: false), ProcessEndTime = table.Column(nullable: false), ProcessProgress = table.Column(nullable: false), Status = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_UploadSessions", x => x.Id); table.ForeignKey( name: "FK_UploadSessions_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "UserRecitationProfiles", columns: table => new { Id = table.Column(nullable: false), UserId = table.Column(nullable: false), Name = table.Column(nullable: true), FileSuffixWithoutDash = table.Column(nullable: true), ArtistName = table.Column(nullable: true), ArtistUrl = table.Column(nullable: true), AudioSrc = table.Column(nullable: true), AudioSrcUrl = table.Column(nullable: true), IsDefault = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserRecitationProfiles", x => x.Id); table.ForeignKey( name: "FK_UserRecitationProfiles_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "GanjoorCategories", columns: table => new { Id = table.Column(nullable: false), PoetId = table.Column(nullable: false), Title = table.Column(nullable: true), ParentId = table.Column(nullable: true), UrlSlug = table.Column(nullable: true), FullUrl = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_GanjoorCategories", x => x.Id); table.ForeignKey( name: "FK_GanjoorCategories_GanjoorCategories_ParentId", column: x => x.ParentId, principalTable: "GanjoorCategories", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_GanjoorCategories_GanjoorPoets_PoetId", column: x => x.PoetId, principalTable: "GanjoorPoets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "RecitationPublishingTrackers", columns: table => new { Id = table.Column(nullable: false), PoemNarrationId = table.Column(nullable: false), StartDate = table.Column(nullable: false), XmlFileCopied = table.Column(nullable: false), Mp3FileCopied = table.Column(nullable: false), FirstDbUpdated = table.Column(nullable: false), SecondDbUpdated = table.Column(nullable: false), Finished = table.Column(nullable: false), FinishDate = table.Column(nullable: false), LastException = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_RecitationPublishingTrackers", x => x.Id); table.ForeignKey( name: "FK_RecitationPublishingTrackers_Recitations_PoemNarrationId", column: x => x.PoemNarrationId, principalTable: "Recitations", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UploadedFiles", columns: table => new { Id = table.Column(nullable: false), UploadSessionId = table.Column(nullable: false), ContentDisposition = table.Column(nullable: true), ContentType = table.Column(nullable: true), FileName = table.Column(nullable: true), Length = table.Column(nullable: false), Name = table.Column(nullable: true), FilePath = table.Column(nullable: true), MP3FileCheckSum = table.Column(nullable: true), ProcessResult = table.Column(nullable: false), ProcessResultMsg = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_UploadedFiles", x => x.Id); table.ForeignKey( name: "FK_UploadedFiles_UploadSessions_UploadSessionId", column: x => x.UploadSessionId, principalTable: "UploadSessions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "GanjoorPoems", columns: table => new { Id = table.Column(nullable: false), CatId = table.Column(nullable: false), Title = table.Column(nullable: true), FullTitle = table.Column(nullable: true), UrlSlug = table.Column(nullable: true), FullUrl = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_GanjoorPoems", x => x.Id); table.ForeignKey( name: "FK_GanjoorPoems_GanjoorCategories_CatId", column: x => x.CatId, principalTable: "GanjoorCategories", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "GanjoorVerses", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), PoemId = table.Column(nullable: false), VOrder = table.Column(nullable: false), VersePosition = table.Column(nullable: false), Text = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_GanjoorVerses", x => x.Id); table.ForeignKey( name: "FK_GanjoorVerses_GanjoorPoems_PoemId", column: x => x.PoemId, principalTable: "GanjoorPoems", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_GanjoorCategories_FullUrl", table: "GanjoorCategories", column: "FullUrl"); migrationBuilder.CreateIndex( name: "IX_GanjoorCategories_ParentId", table: "GanjoorCategories", column: "ParentId"); migrationBuilder.CreateIndex( name: "IX_GanjoorCategories_PoetId", table: "GanjoorCategories", column: "PoetId"); migrationBuilder.CreateIndex( name: "IX_GanjoorPoems_CatId", table: "GanjoorPoems", column: "CatId"); migrationBuilder.CreateIndex( name: "IX_GanjoorPoems_FullUrl", table: "GanjoorPoems", column: "FullUrl"); migrationBuilder.CreateIndex( name: "IX_GanjoorVerses_PoemId", table: "GanjoorVerses", column: "PoemId"); migrationBuilder.CreateIndex( name: "IX_RecitationPublishingTrackers_PoemNarrationId", table: "RecitationPublishingTrackers", column: "PoemNarrationId"); migrationBuilder.CreateIndex( name: "IX_Recitations_GanjoorPostId", table: "Recitations", column: "GanjoorPostId"); migrationBuilder.CreateIndex( name: "IX_Recitations_OwnerId", table: "Recitations", column: "OwnerId"); migrationBuilder.CreateIndex( name: "IX_Recitations_ReviewerId", table: "Recitations", column: "ReviewerId"); migrationBuilder.CreateIndex( name: "IX_UploadedFiles_UploadSessionId", table: "UploadedFiles", column: "UploadSessionId"); migrationBuilder.CreateIndex( name: "IX_UploadSessions_UserId", table: "UploadSessions", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_UserRecitationProfiles_UserId", table: "UserRecitationProfiles", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "GanjoorVerses"); migrationBuilder.DropTable( name: "RecitationPublishingTrackers"); migrationBuilder.DropTable( name: "UploadedFiles"); migrationBuilder.DropTable( name: "UserRecitationProfiles"); migrationBuilder.DropTable( name: "GanjoorPoems"); migrationBuilder.DropTable( name: "Recitations"); migrationBuilder.DropTable( name: "UploadSessions"); migrationBuilder.DropTable( name: "GanjoorCategories"); migrationBuilder.DropTable( name: "GanjoorPoets"); } } }