-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure the migration script is creating tables instead of just cha…
…nging foreign keys (#595)
- Loading branch information
1 parent
73f6845
commit 4be54b1
Showing
3 changed files
with
88 additions
and
78 deletions.
There are no files selected for viewing
77 changes: 0 additions & 77 deletions
77
src/Aquifer.Data/Migrations/20241209143920_AddVersificationMappingAndExclusion.cs
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...sificationMappingAndExclusion.Designer.cs → ...sificationMappingAndExclusion.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
src/Aquifer.Data/Migrations/20241209173443_AddVersificationMappingAndExclusion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Aquifer.Data.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class AddVersificationMappingAndExclusion : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "VersificationExclusions", | ||
columns: table => new | ||
{ | ||
BibleId = table.Column<int>(type: "int", nullable: false), | ||
BibleVerseId = table.Column<int>(type: "int", nullable: false), | ||
VerseId = table.Column<int>(type: "int", nullable: false), | ||
Created = table.Column<DateTime>(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<int>(type: "int", nullable: false) | ||
.Annotation("SqlServer:Identity", "1, 1"), | ||
BibleId = table.Column<int>(type: "int", nullable: false), | ||
BibleVerseId = table.Column<int>(type: "int", nullable: false), | ||
BaseVerseId = table.Column<int>(type: "int", nullable: false), | ||
VerseIdPart = table.Column<string>(type: "nvarchar(1)", nullable: true), | ||
BaseVerseIdPart = table.Column<string>(type: "nvarchar(1)", nullable: true), | ||
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "getutcdate()"), | ||
Updated = table.Column<DateTime>(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"); | ||
}); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "VersificationExclusions"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "VersificationMappings"); | ||
} | ||
} | ||
} |