using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace backend.Migrations { public partial class AddMenu : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "MenuItems", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Title = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: false), Price = table.Column(type: "integer", nullable: false), RestaurantId = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_MenuItems", x => x.Id); table.ForeignKey( name: "FK_MenuItems_Restoraunts_RestaurantId", column: x => x.RestaurantId, principalTable: "Restoraunts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_MenuItems_RestaurantId", table: "MenuItems", column: "RestaurantId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "MenuItems"); } } }