using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DiunaBI.Infrastructure.Migrations { /// public partial class DataSetIdOnDataRow : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_DataRows_DataSets_DataSetId", table: "DataRows"); // DODAJ: Usuń index przed zmianą kolumny migrationBuilder.DropIndex( name: "IX_DataRows_DataSetId", table: "DataRows"); migrationBuilder.AlterColumn( name: "DataSetId", table: "DataRows", type: "uniqueidentifier", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), oldClrType: typeof(Guid), oldType: "uniqueidentifier", oldNullable: true); // DODAJ: Odtwórz index po zmianie kolumny migrationBuilder.CreateIndex( name: "IX_DataRows_DataSetId", table: "DataRows", column: "DataSetId"); migrationBuilder.AddForeignKey( name: "FK_DataRows_DataSets_DataSetId", table: "DataRows", column: "DataSetId", principalTable: "DataSets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_DataRows_DataSets_DataSetId", table: "DataRows"); migrationBuilder.DropIndex( name: "IX_DataRows_DataSetId", table: "DataRows"); migrationBuilder.AlterColumn( name: "DataSetId", table: "DataRows", type: "uniqueidentifier", nullable: true, oldClrType: typeof(Guid), oldType: "uniqueidentifier"); migrationBuilder.CreateIndex( name: "IX_DataRows_DataSetId", table: "DataRows", column: "DataSetId"); migrationBuilder.AddForeignKey( name: "FK_DataRows_DataSets_DataSetId", table: "DataRows", column: "DataSetId", principalTable: "DataSets", principalColumn: "Id"); } } }