using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ComputerShopDatabaseImplement.Migrations { /// public partial class clientmigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "ClientId", table: "Supplies", type: "int", nullable: true); migrationBuilder.AddColumn( name: "ClientId", table: "Purchases", type: "int", nullable: true); migrationBuilder.AddColumn( name: "ClientId", table: "Orders", type: "int", nullable: true); migrationBuilder.AddColumn( name: "ClientId", table: "EquipmentReceivings", type: "int", nullable: true); migrationBuilder.AddColumn( name: "ClientId", table: "Assemblies", type: "int", nullable: true); 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_Supplies_ClientId", table: "Supplies", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_Purchases_ClientId", table: "Purchases", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_Orders_ClientId", table: "Orders", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EquipmentReceivings_ClientId", table: "EquipmentReceivings", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_Assemblies_ClientId", table: "Assemblies", column: "ClientId"); migrationBuilder.AddForeignKey( name: "FK_Assemblies_Clients_ClientId", table: "Assemblies", column: "ClientId", principalTable: "Clients", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_EquipmentReceivings_Clients_ClientId", table: "EquipmentReceivings", column: "ClientId", principalTable: "Clients", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Orders_Clients_ClientId", table: "Orders", column: "ClientId", principalTable: "Clients", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Purchases_Clients_ClientId", table: "Purchases", column: "ClientId", principalTable: "Clients", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Supplies_Clients_ClientId", table: "Supplies", column: "ClientId", principalTable: "Clients", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Assemblies_Clients_ClientId", table: "Assemblies"); migrationBuilder.DropForeignKey( name: "FK_EquipmentReceivings_Clients_ClientId", table: "EquipmentReceivings"); migrationBuilder.DropForeignKey( name: "FK_Orders_Clients_ClientId", table: "Orders"); migrationBuilder.DropForeignKey( name: "FK_Purchases_Clients_ClientId", table: "Purchases"); migrationBuilder.DropForeignKey( name: "FK_Supplies_Clients_ClientId", table: "Supplies"); migrationBuilder.DropTable( name: "Clients"); migrationBuilder.DropIndex( name: "IX_Supplies_ClientId", table: "Supplies"); migrationBuilder.DropIndex( name: "IX_Purchases_ClientId", table: "Purchases"); migrationBuilder.DropIndex( name: "IX_Orders_ClientId", table: "Orders"); migrationBuilder.DropIndex( name: "IX_EquipmentReceivings_ClientId", table: "EquipmentReceivings"); migrationBuilder.DropIndex( name: "IX_Assemblies_ClientId", table: "Assemblies"); migrationBuilder.DropColumn( name: "ClientId", table: "Supplies"); migrationBuilder.DropColumn( name: "ClientId", table: "Purchases"); migrationBuilder.DropColumn( name: "ClientId", table: "Orders"); migrationBuilder.DropColumn( name: "ClientId", table: "EquipmentReceivings"); migrationBuilder.DropColumn( name: "ClientId", table: "Assemblies"); } } }