using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CartriX.Api.Migrations { /// public partial class Init1 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Locations", columns: table => new { id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), name = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Locations", x => x.id); }); migrationBuilder.CreateTable( name: "PrinterModels", columns: table => new { id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), name = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PrinterModels", x => x.id); }); migrationBuilder.CreateTable( name: "Printers", columns: table => new { id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), hostname = table.Column(type: "TEXT", nullable: false), ipAddress = table.Column(type: "TEXT", nullable: false), locationId = table.Column(type: "INTEGER", nullable: true), modelId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Printers", x => x.id); table.ForeignKey( name: "FK_Printers_Locations_locationId", column: x => x.locationId, principalTable: "Locations", principalColumn: "id"); table.ForeignKey( name: "FK_Printers_PrinterModels_modelId", column: x => x.modelId, principalTable: "PrinterModels", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Locations_name", table: "Locations", column: "name", unique: true); migrationBuilder.CreateIndex( name: "IX_Printers_locationId", table: "Printers", column: "locationId"); migrationBuilder.CreateIndex( name: "IX_Printers_modelId", table: "Printers", column: "modelId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Printers"); migrationBuilder.DropTable( name: "Locations"); migrationBuilder.DropTable( name: "PrinterModels"); } } }