Init
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticAssets.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixIsinKey : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<string>(
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user