mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 20:40:55 +00:00
Починил связи сущностей
This commit is contained in:
1 parent
f597c0f4b3
commit
c229049791
13 files changed
+1283
-89
No files matched your search
@@ -0,0 +1,75 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CartriX.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init6 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Articles_CartridgeArticles_CartridgeArticleId",
|
||||
table: "Articles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CartridgeArticles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Articles_CartridgeArticleId",
|
||||
table: "Articles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CartridgeArticleId",
|
||||
table: "Articles");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CartridgeArticleId",
|
||||
table: "Articles",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CartridgeArticles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
CartridgeModelId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CartridgeArticles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CartridgeArticles_CartridgeModels_CartridgeModelId",
|
||||
column: x => x.CartridgeModelId,
|
||||
principalTable: "CartridgeModels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Articles_CartridgeArticleId",
|
||||
table: "Articles",
|
||||
column: "CartridgeArticleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CartridgeArticles_CartridgeModelId",
|
||||
table: "CartridgeArticles",
|
||||
column: "CartridgeModelId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Articles_CartridgeArticles_CartridgeArticleId",
|
||||
table: "Articles",
|
||||
column: "CartridgeArticleId",
|
||||
principalTable: "CartridgeArticles",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user