127 lines
6.3 KiB
C#
127 lines
6.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace FinlyticAssets.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Init : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Settings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
FinishedInitialScan = table.Column<bool>(type: "boolean", nullable: false),
|
|
MinRandomUpdateDay = table.Column<int>(type: "integer", nullable: false),
|
|
MaxRandomUpdateDay = table.Column<int>(type: "integer", nullable: false),
|
|
UpdateDayTimeStart = table.Column<int>(type: "integer", nullable: false),
|
|
UpdateDayTimeStop = table.Column<int>(type: "integer", nullable: false),
|
|
TradeRepublicMaxRequestPageSize = table.Column<int>(type: "integer", nullable: false),
|
|
AssetUpdateTypeDelay = table.Column<int>(type: "integer", nullable: false),
|
|
InitAssetUpdateTypeDelay = table.Column<int>(type: "integer", nullable: false),
|
|
InitBatchAssetUpdateDelay = table.Column<int>(type: "integer", nullable: false),
|
|
BatchAssetUpdateDelay = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Settings", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TradeRepublicAssets",
|
|
columns: table => new
|
|
{
|
|
Isin = table.Column<string>(type: "text", nullable: false),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Type = table.Column<string>(type: "text", nullable: false),
|
|
InstrumentCategory = table.Column<string>(type: "text", nullable: false),
|
|
HasCfd = table.Column<bool>(type: "boolean", nullable: false),
|
|
ImageId = table.Column<string>(type: "text", nullable: true),
|
|
UpdateAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
LastUpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
AssetType = table.Column<string>(type: "character varying(13)", maxLength: 13, nullable: false),
|
|
BondIssuerName = table.Column<string>(type: "text", nullable: true),
|
|
SearchSubtitle = table.Column<string>(type: "text", nullable: true),
|
|
Subtitle = table.Column<string>(type: "text", nullable: true),
|
|
CryptoEntity_SearchSubtitle = table.Column<string>(type: "text", nullable: true),
|
|
DerivativeProductCategories = table.Column<string>(type: "text", nullable: true),
|
|
UnderlyingIsin = table.Column<string>(type: "text", nullable: true),
|
|
EtfEntity_DerivativeProductCategories = table.Column<string>(type: "text", nullable: true),
|
|
EtfDescription = table.Column<string>(type: "text", nullable: true),
|
|
MappedEtfIndexName = table.Column<string>(type: "text", nullable: true),
|
|
EtfEntity_Subtitle = table.Column<string>(type: "text", nullable: true),
|
|
EtfEntity_SearchSubtitle = table.Column<string>(type: "text", nullable: true),
|
|
StockEntity_DerivativeProductCategories = table.Column<string>(type: "text", nullable: true),
|
|
SyntheticEntity_DerivativeProductCategories = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TradeRepublicAssets", x => x.Isin);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TradeRepublicTags",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "text", nullable: false),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
Type = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TradeRepublicTags", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AssetEntityTagEntity",
|
|
columns: table => new
|
|
{
|
|
AssetsIsin = table.Column<string>(type: "text", nullable: false),
|
|
TagsId = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AssetEntityTagEntity", x => new { x.AssetsIsin, x.TagsId });
|
|
table.ForeignKey(
|
|
name: "FK_AssetEntityTagEntity_TradeRepublicAssets_AssetsIsin",
|
|
column: x => x.AssetsIsin,
|
|
principalTable: "TradeRepublicAssets",
|
|
principalColumn: "Isin",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AssetEntityTagEntity_TradeRepublicTags_TagsId",
|
|
column: x => x.TagsId,
|
|
principalTable: "TradeRepublicTags",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AssetEntityTagEntity_TagsId",
|
|
table: "AssetEntityTagEntity",
|
|
column: "TagsId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AssetEntityTagEntity");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Settings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TradeRepublicAssets");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TradeRepublicTags");
|
|
}
|
|
}
|
|
}
|