Fix ListeningProgress migration by clearing old episode rows.
build-and-deploy / deploy (push) Successful in 2m38s
build-and-deploy / deploy (push) Successful in 2m38s
Renaming EpisodeId to TafsirId left invalid SurahId defaults that failed FK checks.
This commit is contained in:
+21
-8
@@ -21,29 +21,42 @@ namespace TafsirQuran.Infrastructure.Persistence.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Favorites");
|
name: "Favorites");
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
// Episode-based progress cannot map cleanly to Surah/Ayah; reset rows.
|
||||||
name: "EpisodeId",
|
migrationBuilder.Sql("DELETE FROM [ListeningProgresses];");
|
||||||
table: "ListeningProgresses",
|
|
||||||
newName: "TafsirId");
|
|
||||||
|
|
||||||
migrationBuilder.RenameIndex(
|
migrationBuilder.DropIndex(
|
||||||
name: "IX_ListeningProgresses_EpisodeId",
|
name: "IX_ListeningProgresses_EpisodeId",
|
||||||
|
table: "ListeningProgresses");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "EpisodeId",
|
||||||
|
table: "ListeningProgresses");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "TafsirId",
|
||||||
table: "ListeningProgresses",
|
table: "ListeningProgresses",
|
||||||
newName: "IX_ListeningProgresses_TafsirId");
|
type: "uniqueidentifier",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("11111111-1111-1111-1111-111111111111"));
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
migrationBuilder.AddColumn<int>(
|
||||||
name: "AyahNumber",
|
name: "AyahNumber",
|
||||||
table: "ListeningProgresses",
|
table: "ListeningProgresses",
|
||||||
type: "int",
|
type: "int",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: 0);
|
defaultValue: 1);
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
migrationBuilder.AddColumn<int>(
|
||||||
name: "SurahId",
|
name: "SurahId",
|
||||||
table: "ListeningProgresses",
|
table: "ListeningProgresses",
|
||||||
type: "int",
|
type: "int",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: 0);
|
defaultValue: 1);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ListeningProgresses_TafsirId",
|
||||||
|
table: "ListeningProgresses",
|
||||||
|
column: "TafsirId");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "AyahBookmarks",
|
name: "AyahBookmarks",
|
||||||
|
|||||||
Reference in New Issue
Block a user