diff --git a/src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.cs b/src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.cs deleted file mode 100644 index ac2b1cc0..00000000 --- a/src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Aquifer.Data.Migrations -{ - /// - public partial class AddVersificationMappingAndExclusion : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddForeignKey( - name: "FK_VersificationExclusions_Bibles_BibleId", - table: "VersificationExclusions", - column: "BibleId", - principalTable: "Bibles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_VersificationExclusions_Verses_VerseId", - table: "VersificationExclusions", - column: "VerseId", - principalTable: "Verses", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_VersificationMappings_Bibles_BibleId", - table: "VersificationMappings", - column: "BibleId", - principalTable: "Bibles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_VersificationMappings_Verses_BaseVerseId", - table: "VersificationMappings", - column: "BaseVerseId", - principalTable: "Verses", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_VersificationMappings_Verses_BibleVerseId", - table: "VersificationMappings", - column: "BibleVerseId", - principalTable: "Verses", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_VersificationExclusions_Bibles_BibleId", - table: "VersificationExclusions"); - - migrationBuilder.DropForeignKey( - name: "FK_VersificationExclusions_Verses_VerseId", - table: "VersificationExclusions"); - - migrationBuilder.DropForeignKey( - name: "FK_VersificationMappings_Bibles_BibleId", - table: "VersificationMappings"); - - migrationBuilder.DropForeignKey( - name: "FK_VersificationMappings_Verses_BaseVerseId", - table: "VersificationMappings"); - - migrationBuilder.DropForeignKey( - name: "FK_VersificationMappings_Verses_BibleVerseId", - table: "VersificationMappings"); - } - } -} diff --git a/src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.Designer.cs b/src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.Designer.cs similarity index 99% rename from src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.Designer.cs rename to src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.Designer.cs index 3fd98ef2..8873b4b3 100644 --- a/src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.Designer.cs +++ b/src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.Designer.cs @@ -12,7 +12,7 @@ namespace Aquifer.Data.Migrations { [DbContext(typeof(AquiferDbContext))] - [Migration("20241209143920_AddVersificationMappingAndExclusion")] + [Migration("20241209173443_AddVersificationMappingAndExclusion")] partial class AddVersificationMappingAndExclusion { /// diff --git a/src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.cs b/src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.cs new file mode 100644 index 00000000..fa635d22 --- /dev/null +++ b/src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.cs @@ -0,0 +1,87 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Aquifer.Data.Migrations +{ + /// + public partial class AddVersificationMappingAndExclusion : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "VersificationExclusions", + columns: table => new + { + BibleId = table.Column(type: "int", nullable: false), + BibleVerseId = table.Column(type: "int", nullable: false), + VerseId = table.Column(type: "int", nullable: false), + Created = table.Column(type: "datetime2", nullable: false, defaultValueSql: "getutcdate()") + }, + constraints: table => + { + table.PrimaryKey("PK_VersificationExclusions", x => new { x.BibleId, x.BibleVerseId }); + table.ForeignKey( + name: "FK_VersificationExclusions_Bibles_BibleId", + column: x => x.BibleId, + principalTable: "Bibles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_VersificationExclusions_Verses_VerseId", + column: x => x.VerseId, + principalTable: "Verses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "VersificationMappings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BibleId = table.Column(type: "int", nullable: false), + BibleVerseId = table.Column(type: "int", nullable: false), + BaseVerseId = table.Column(type: "int", nullable: false), + VerseIdPart = table.Column(type: "nvarchar(1)", nullable: true), + BaseVerseIdPart = table.Column(type: "nvarchar(1)", nullable: true), + Created = table.Column(type: "datetime2", nullable: false, defaultValueSql: "getutcdate()"), + Updated = table.Column(type: "datetime2", nullable: false, defaultValueSql: "getutcdate()") + }, + constraints: table => + { + table.PrimaryKey("PK_VersificationMappings", x => x.Id); + table.ForeignKey( + name: "FK_VersificationMappings_Bibles_BibleId", + column: x => x.BibleId, + principalTable: "Bibles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_VersificationMappings_Verses_BaseVerseId", + column: x => x.BaseVerseId, + principalTable: "Verses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_VersificationMappings_Verses_BibleVerseId", + column: x => x.BibleVerseId, + principalTable: "Verses", + principalColumn: "Id"); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "VersificationExclusions"); + + migrationBuilder.DropTable( + name: "VersificationMappings"); + } + } +}