using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Server.Migrations { public partial class Add_CompanyDriver_relation : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "CompanyDrivers", columns: table => new { DriverId = table.Column(type: "text", nullable: false), CompanyId = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CompanyDrivers", x => new { x.CompanyId, x.DriverId }); table.ForeignKey( name: "FK_CompanyDrivers_AspNetUsers_DriverId", column: x => x.DriverId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_CompanyDrivers_Companies_CompanyId", column: x => x.CompanyId, principalTable: "Companies", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_CompanyDrivers_DriverId", table: "CompanyDrivers", column: "DriverId", unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CompanyDrivers"); } } }