Files
Finlytic/FinlyticFundamentals/Migrations/20260814211010_Init.cs
T

207 lines
9.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FinlyticFundamentals.Migrations
{
/// <inheritdoc />
public partial class Init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AssetData",
columns: table => new
{
Isin = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
PrimaryTicker = table.Column<string>(type: "text", nullable: false, defaultValue: ""),
PrimaryTickerExchange = table.Column<string>(type: "text", nullable: false, defaultValue: "")
},
constraints: table =>
{
table.PrimaryKey("PK_AssetData", x => x.Isin);
});
migrationBuilder.CreateTable(
name: "DynamicSettings",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Key = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: false),
ValueJson = table.Column<string>(type: "text", nullable: false),
ServiceIdentifier = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
LastUpdatedUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DynamicSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AssetEvents",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Ticker = table.Column<string>(type: "text", nullable: false, defaultValue: ""),
TickerExchange = table.Column<string>(type: "text", nullable: false, defaultValue: ""),
Type = table.Column<string>(type: "text", nullable: false),
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
AssetDataIsin = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AssetEvents", x => x.Id);
table.ForeignKey(
name: "FK_AssetEvents_AssetData_AssetDataIsin",
column: x => x.AssetDataIsin,
principalTable: "AssetData",
principalColumn: "Isin",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "FundamentalData",
columns: table => new
{
Isin = table.Column<string>(type: "text", nullable: false),
Ticker = table.Column<string>(type: "text", nullable: false, defaultValue: ""),
TickerExchange = table.Column<string>(type: "text", nullable: false, defaultValue: ""),
MarketCap = table.Column<decimal>(type: "numeric", nullable: true),
EnterpriseValue = table.Column<decimal>(type: "numeric", nullable: true),
TrailingPe = table.Column<decimal>(type: "numeric", nullable: true),
ForwardPe = table.Column<decimal>(type: "numeric", nullable: true),
PegRatio = table.Column<decimal>(type: "numeric", nullable: true),
PriceToSales = table.Column<decimal>(type: "numeric", nullable: true),
PriceToBook = table.Column<decimal>(type: "numeric", nullable: true),
EvToEbitda = table.Column<decimal>(type: "numeric", nullable: true),
TotalRevenue = table.Column<decimal>(type: "numeric", nullable: true),
RevenueGrowthYoY = table.Column<decimal>(type: "numeric", nullable: true),
GrossProfit = table.Column<decimal>(type: "numeric", nullable: true),
OperatingIncome = table.Column<decimal>(type: "numeric", nullable: true),
Ebitda = table.Column<decimal>(type: "numeric", nullable: true),
NetIncome = table.Column<decimal>(type: "numeric", nullable: true),
DilutedEps = table.Column<decimal>(type: "numeric", nullable: true),
TotalCash = table.Column<decimal>(type: "numeric", nullable: true),
TotalDebt = table.Column<decimal>(type: "numeric", nullable: true),
DebtToEquity = table.Column<decimal>(type: "numeric", nullable: true),
CurrentRatio = table.Column<decimal>(type: "numeric", nullable: true),
OperatingCashFlow = table.Column<decimal>(type: "numeric", nullable: true),
FreeCashFlow = table.Column<decimal>(type: "numeric", nullable: true),
ReturnOnEquity = table.Column<decimal>(type: "numeric", nullable: true),
ReturnOnAssets = table.Column<decimal>(type: "numeric", nullable: true),
ForwardDividendYield = table.Column<decimal>(type: "numeric", nullable: true),
PayoutRatio = table.Column<decimal>(type: "numeric", nullable: true),
LastUpdatedUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
AssetDataIsin = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FundamentalData", x => x.Isin);
table.ForeignKey(
name: "FK_FundamentalData_AssetData_AssetDataIsin",
column: x => x.AssetDataIsin,
principalTable: "AssetData",
principalColumn: "Isin",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "KeyExecutives",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
Payment = table.Column<string>(type: "text", nullable: false),
AssetDataIsin = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_KeyExecutives", x => x.Id);
table.ForeignKey(
name: "FK_KeyExecutives_AssetData_AssetDataIsin",
column: x => x.AssetDataIsin,
principalTable: "AssetData",
principalColumn: "Isin",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Tickers",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Ticker = table.Column<string>(type: "text", nullable: false),
Exchange = table.Column<string>(type: "text", nullable: false),
AssetDataIsin = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tickers", x => x.Id);
table.ForeignKey(
name: "FK_Tickers_AssetData_AssetDataIsin",
column: x => x.AssetDataIsin,
principalTable: "AssetData",
principalColumn: "Isin",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AssetEvents_AssetDataIsin",
table: "AssetEvents",
column: "AssetDataIsin");
migrationBuilder.CreateIndex(
name: "IX_DynamicSettings_Key",
table: "DynamicSettings",
column: "Key");
migrationBuilder.CreateIndex(
name: "IX_FundamentalData_AssetDataIsin",
table: "FundamentalData",
column: "AssetDataIsin");
migrationBuilder.CreateIndex(
name: "IX_KeyExecutives_AssetDataIsin",
table: "KeyExecutives",
column: "AssetDataIsin");
migrationBuilder.CreateIndex(
name: "IX_Tickers_AssetDataIsin",
table: "Tickers",
column: "AssetDataIsin");
migrationBuilder.CreateIndex(
name: "IX_Tickers_Ticker",
table: "Tickers",
column: "Ticker");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AssetEvents");
migrationBuilder.DropTable(
name: "DynamicSettings");
migrationBuilder.DropTable(
name: "FundamentalData");
migrationBuilder.DropTable(
name: "KeyExecutives");
migrationBuilder.DropTable(
name: "Tickers");
migrationBuilder.DropTable(
name: "AssetData");
}
}
}