source: resTools_backend/backend/Migrations/20220706103351_Add-Menu.cs

Last change on this file was cc4db18, checked in by Danilo <danilo.najkov@…>, 2 years ago

reservation module changes + contact module + menu module

  • Property mode set to 100644
File size: 1.8 KB
Line 
1using Microsoft.EntityFrameworkCore.Migrations;
2using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
3
4#nullable disable
5
6namespace 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}
Note: See TracBrowser for help on using the repository browser.