diff --git a/src/TafsirQuran.Infrastructure/Persistence/Migrations/20261009205128_AyahBrowseAndGharaati.cs b/src/TafsirQuran.Infrastructure/Persistence/Migrations/20261009205128_AyahBrowseAndGharaati.cs index 665d1d0..a02b6e1 100644 --- a/src/TafsirQuran.Infrastructure/Persistence/Migrations/20261009205128_AyahBrowseAndGharaati.cs +++ b/src/TafsirQuran.Infrastructure/Persistence/Migrations/20261009205128_AyahBrowseAndGharaati.cs @@ -21,29 +21,42 @@ namespace TafsirQuran.Infrastructure.Persistence.Migrations migrationBuilder.DropTable( name: "Favorites"); - migrationBuilder.RenameColumn( - name: "EpisodeId", - table: "ListeningProgresses", - newName: "TafsirId"); + // Episode-based progress cannot map cleanly to Surah/Ayah; reset rows. + migrationBuilder.Sql("DELETE FROM [ListeningProgresses];"); - migrationBuilder.RenameIndex( + migrationBuilder.DropIndex( name: "IX_ListeningProgresses_EpisodeId", + table: "ListeningProgresses"); + + migrationBuilder.DropColumn( + name: "EpisodeId", + table: "ListeningProgresses"); + + migrationBuilder.AddColumn( + name: "TafsirId", table: "ListeningProgresses", - newName: "IX_ListeningProgresses_TafsirId"); + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("11111111-1111-1111-1111-111111111111")); migrationBuilder.AddColumn( name: "AyahNumber", table: "ListeningProgresses", type: "int", nullable: false, - defaultValue: 0); + defaultValue: 1); migrationBuilder.AddColumn( name: "SurahId", table: "ListeningProgresses", type: "int", nullable: false, - defaultValue: 0); + defaultValue: 1); + + migrationBuilder.CreateIndex( + name: "IX_ListeningProgresses_TafsirId", + table: "ListeningProgresses", + column: "TafsirId"); migrationBuilder.CreateTable( name: "AyahBookmarks",