using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LawFirmDatabaseImplement.Migrations { /// public partial class DBClientUpdate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql("DELETE FROM [dbo].[Orders]"); migrationBuilder.AddColumn( name: "ClientId", table: "Orders", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "Clients", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), Email = table.Column(type: "nvarchar(max)", nullable: false), Password = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Clients", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_Orders_ClientId", table: "Orders", column: "ClientId"); migrationBuilder.AddForeignKey( name: "FK_Orders_Clients_ClientId", table: "Orders", column: "ClientId", principalTable: "Clients", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Orders_Clients_ClientId", table: "Orders"); migrationBuilder.DropTable( name: "Clients"); migrationBuilder.DropIndex( name: "IX_Orders_ClientId", table: "Orders"); migrationBuilder.DropColumn( name: "ClientId", table: "Orders"); } } }