[cc4db18] | 1 | using Microsoft.EntityFrameworkCore.Migrations;
|
---|
| 2 | using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
---|
| 3 |
|
---|
| 4 | #nullable disable
|
---|
| 5 |
|
---|
| 6 | namespace backend.Migrations
|
---|
| 7 | {
|
---|
| 8 | public partial class AddMenu : Migration
|
---|
| 9 | {
|
---|
| 10 | protected override void Up(MigrationBuilder migrationBuilder)
|
---|
| 11 | {
|
---|
| 12 | migrationBuilder.CreateTable(
|
---|
| 13 | name: "MenuItems",
|
---|
| 14 | columns: table => new
|
---|
| 15 | {
|
---|
| 16 | Id = table.Column<int>(type: "integer", nullable: false)
|
---|
| 17 | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
---|
| 18 | Title = table.Column<string>(type: "text", nullable: false),
|
---|
| 19 | Description = table.Column<string>(type: "text", nullable: false),
|
---|
| 20 | Price = table.Column<int>(type: "integer", nullable: false),
|
---|
| 21 | RestaurantId = table.Column<int>(type: "integer", nullable: false)
|
---|
| 22 | },
|
---|
| 23 | constraints: table =>
|
---|
| 24 | {
|
---|
| 25 | table.PrimaryKey("PK_MenuItems", x => x.Id);
|
---|
| 26 | table.ForeignKey(
|
---|
| 27 | name: "FK_MenuItems_Restoraunts_RestaurantId",
|
---|
| 28 | column: x => x.RestaurantId,
|
---|
| 29 | principalTable: "Restoraunts",
|
---|
| 30 | principalColumn: "Id",
|
---|
| 31 | onDelete: ReferentialAction.Cascade);
|
---|
| 32 | });
|
---|
| 33 |
|
---|
| 34 | migrationBuilder.CreateIndex(
|
---|
| 35 | name: "IX_MenuItems_RestaurantId",
|
---|
| 36 | table: "MenuItems",
|
---|
| 37 | column: "RestaurantId");
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | protected override void Down(MigrationBuilder migrationBuilder)
|
---|
| 41 | {
|
---|
| 42 | migrationBuilder.DropTable(
|
---|
| 43 | name: "MenuItems");
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | }
|
---|