mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 20:40:55 +00:00
as
This commit is contained in:
1 parent
a987494d29
commit
69e4c977cb
32 files changed
+721
-487
No files matched your search
@@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CartriX.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CartridgePrinter");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CartridgesInPrinterId",
|
||||
table: "Cartridges",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cartridges_CartridgesInPrinterId",
|
||||
table: "Cartridges",
|
||||
column: "CartridgesInPrinterId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Cartridges_Printers_CartridgesInPrinterId",
|
||||
table: "Cartridges",
|
||||
column: "CartridgesInPrinterId",
|
||||
principalTable: "Printers",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Cartridges_Printers_CartridgesInPrinterId",
|
||||
table: "Cartridges");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Cartridges_CartridgesInPrinterId",
|
||||
table: "Cartridges");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CartridgesInPrinterId",
|
||||
table: "Cartridges");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CartridgePrinter",
|
||||
columns: table => new
|
||||
{
|
||||
CartridgesHaveId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
CartridgesInPrinterId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CartridgePrinter", x => new { x.CartridgesHaveId, x.CartridgesInPrinterId });
|
||||
table.ForeignKey(
|
||||
name: "FK_CartridgePrinter_Cartridges_CartridgesHaveId",
|
||||
column: x => x.CartridgesHaveId,
|
||||
principalTable: "Cartridges",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CartridgePrinter_Printers_CartridgesInPrinterId",
|
||||
column: x => x.CartridgesInPrinterId,
|
||||
principalTable: "Printers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CartridgePrinter_CartridgesInPrinterId",
|
||||
table: "CartridgePrinter",
|
||||
column: "CartridgesInPrinterId");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user