using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace EntityFrameworkCore.Data.Migrations { /// public partial class AddManyToManyRelationshipTeamsMatches : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "AwayTeamScore", table: "Matches", type: "INTEGER", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "HomeTeamScore", table: "Matches", type: "INTEGER", nullable: false, defaultValue: 0); migrationBuilder.CreateIndex( name: "IX_Teams_Name", table: "Teams", column: "Name", unique: true); migrationBuilder.CreateIndex( name: "IX_Matches_AwayTeamId", table: "Matches", column: "AwayTeamId"); migrationBuilder.CreateIndex( name: "IX_Matches_HomeTeamId", table: "Matches", column: "HomeTeamId"); migrationBuilder.AddForeignKey( name: "FK_Matches_Teams_AwayTeamId", table: "Matches", column: "AwayTeamId", principalTable: "Teams", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Matches_Teams_HomeTeamId", table: "Matches", column: "HomeTeamId", principalTable: "Teams", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Matches_Teams_AwayTeamId", table: "Matches"); migrationBuilder.DropForeignKey( name: "FK_Matches_Teams_HomeTeamId", table: "Matches"); migrationBuilder.DropIndex( name: "IX_Teams_Name", table: "Teams"); migrationBuilder.DropIndex( name: "IX_Matches_AwayTeamId", table: "Matches"); migrationBuilder.DropIndex( name: "IX_Matches_HomeTeamId", table: "Matches"); migrationBuilder.DropColumn( name: "AwayTeamScore", table: "Matches"); migrationBuilder.DropColumn( name: "HomeTeamScore", table: "Matches"); } } }