using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ComputerShopDatabaseImplement.Migrations { /// <inheritdoc /> public partial class clientmigration : Migration { /// <inheritdoc /> protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<int>( name: "ClientId", table: "Supplies", type: "int", nullable: true); migrationBuilder.AddColumn<int>( name: "ClientId", table: "Purchases", type: "int", nullable: true); migrationBuilder.AddColumn<int>( name: "ClientId", table: "Orders", type: "int", nullable: true); migrationBuilder.AddColumn<int>( name: "ClientId", table: "EquipmentReceivings", type: "int", nullable: true); migrationBuilder.AddColumn<int>( name: "ClientId", table: "Assemblies", type: "int", nullable: true); migrationBuilder.CreateTable( name: "Clients", columns: table => new { Id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false), Email = table.Column<string>(type: "nvarchar(max)", nullable: false), Password = table.Column<string>(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"); } /// <inheritdoc /> 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"); } } }