using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ShoppingCartStarter.Server.Migrations { public partial class Initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Carts", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), SessionId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Carts", x => x.Id); }); migrationBuilder.CreateTable( name: "LineItem", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: true), Quantity = table.Column(type: "INTEGER", nullable: false), Price = table.Column(type: "TEXT", nullable: false), Image = table.Column(type: "TEXT", nullable: true), ShoppingCartId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_LineItem", x => x.Id); table.ForeignKey( name: "FK_LineItem_Carts_ShoppingCartId", column: x => x.ShoppingCartId, principalTable: "Carts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_LineItem_ShoppingCartId", table: "LineItem", column: "ShoppingCartId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "LineItem"); migrationBuilder.DropTable( name: "Carts"); } } }