using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FinlyticAssets.Migrations { /// public partial class FixIsinKey : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_AssetEntityTagEntity_TradeRepublicAssets_AssetsIsin", table: "AssetEntityTagEntity"); migrationBuilder.DropPrimaryKey( name: "PK_TradeRepublicAssets", table: "TradeRepublicAssets"); migrationBuilder.DropPrimaryKey( name: "PK_AssetEntityTagEntity", table: "AssetEntityTagEntity"); migrationBuilder.DropIndex( name: "IX_AssetEntityTagEntity_TagsId", table: "AssetEntityTagEntity"); migrationBuilder.AddColumn( name: "AssetsInstrumentCategory", table: "AssetEntityTagEntity", type: "text", nullable: false, defaultValue: ""); migrationBuilder.AddPrimaryKey( name: "PK_TradeRepublicAssets", table: "TradeRepublicAssets", columns: new[] { "Isin", "InstrumentCategory" }); migrationBuilder.AddPrimaryKey( name: "PK_AssetEntityTagEntity", table: "AssetEntityTagEntity", columns: new[] { "TagsId", "AssetsIsin", "AssetsInstrumentCategory" }); migrationBuilder.CreateIndex( name: "IX_AssetEntityTagEntity_AssetsIsin_AssetsInstrumentCategory", table: "AssetEntityTagEntity", columns: new[] { "AssetsIsin", "AssetsInstrumentCategory" }); migrationBuilder.AddForeignKey( name: "FK_AssetEntityTagEntity_TradeRepublicAssets_AssetsIsin_AssetsI~", table: "AssetEntityTagEntity", columns: new[] { "AssetsIsin", "AssetsInstrumentCategory" }, principalTable: "TradeRepublicAssets", principalColumns: new[] { "Isin", "InstrumentCategory" }, onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_AssetEntityTagEntity_TradeRepublicAssets_AssetsIsin_AssetsI~", table: "AssetEntityTagEntity"); migrationBuilder.DropPrimaryKey( name: "PK_TradeRepublicAssets", table: "TradeRepublicAssets"); migrationBuilder.DropPrimaryKey( name: "PK_AssetEntityTagEntity", table: "AssetEntityTagEntity"); migrationBuilder.DropIndex( name: "IX_AssetEntityTagEntity_AssetsIsin_AssetsInstrumentCategory", table: "AssetEntityTagEntity"); migrationBuilder.DropColumn( name: "AssetsInstrumentCategory", table: "AssetEntityTagEntity"); migrationBuilder.AddPrimaryKey( name: "PK_TradeRepublicAssets", table: "TradeRepublicAssets", column: "Isin"); migrationBuilder.AddPrimaryKey( name: "PK_AssetEntityTagEntity", table: "AssetEntityTagEntity", columns: new[] { "AssetsIsin", "TagsId" }); migrationBuilder.CreateIndex( name: "IX_AssetEntityTagEntity_TagsId", table: "AssetEntityTagEntity", column: "TagsId"); migrationBuilder.AddForeignKey( name: "FK_AssetEntityTagEntity_TradeRepublicAssets_AssetsIsin", table: "AssetEntityTagEntity", column: "AssetsIsin", principalTable: "TradeRepublicAssets", principalColumn: "Isin", onDelete: ReferentialAction.Cascade); } } }