using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SushiBarDatabaseImplement.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Buyers", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), BuyerName = table.Column(type: "nvarchar(max)", nullable: false), BuyerBirthDate = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Buyers", x => x.Id); }); migrationBuilder.CreateTable( name: "Cooks", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CookName = table.Column(type: "nvarchar(max)", nullable: false), CookSurname = table.Column(type: "nvarchar(max)", nullable: false), Experience = table.Column(type: "int", nullable: false), PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false), Passport = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Cooks", x => x.Id); }); migrationBuilder.CreateTable( name: "Menus", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FoodName = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), Price = table.Column(type: "float", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Menus", x => x.Id); }); migrationBuilder.CreateTable( name: "Places", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), PlaceNumber = table.Column(type: "int", nullable: false), CountPlaces = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Places", x => x.Id); }); migrationBuilder.CreateTable( name: "Tasks", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TaskDate = table.Column(type: "datetime2", nullable: false), Status = table.Column(type: "int", nullable: false), FullPrice = table.Column(type: "float", nullable: false), PlaceId = table.Column(type: "int", nullable: false), CookId = table.Column(type: "int", nullable: false), BuyerId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Tasks", x => x.Id); }); migrationBuilder.CreateTable( name: "TaskMenus", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TaskId = table.Column(type: "int", nullable: false), MenuId = table.Column(type: "int", nullable: false), Count = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TaskMenus", x => x.Id); table.ForeignKey( name: "FK_TaskMenus_Menus_MenuId", column: x => x.MenuId, principalTable: "Menus", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_TaskMenus_Tasks_TaskId", column: x => x.TaskId, principalTable: "Tasks", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_TaskMenus_MenuId", table: "TaskMenus", column: "MenuId"); migrationBuilder.CreateIndex( name: "IX_TaskMenus_TaskId", table: "TaskMenus", column: "TaskId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Buyers"); migrationBuilder.DropTable( name: "Cooks"); migrationBuilder.DropTable( name: "Places"); migrationBuilder.DropTable( name: "TaskMenus"); migrationBuilder.DropTable( name: "Menus"); migrationBuilder.DropTable( name: "Tasks"); } } }