using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CartriX.Api.Migrations
{
///
public partial class Init1 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Cartridges",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Capacity = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Cartridges", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Printers",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PrinterName = table.Column(type: "TEXT", nullable: false),
IpAddress = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Printers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CartridgePrinter",
columns: table => new
{
CartridgesHaveId = table.Column(type: "INTEGER", nullable: false),
CartridgesInPrinterId = table.Column(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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CartridgePrinter");
migrationBuilder.DropTable(
name: "Cartridges");
migrationBuilder.DropTable(
name: "Printers");
}
}
}