Files
StockWebHistory/StockWebHistory/Migrations/20260909152107_initialcreate.cs

88 lines
3.7 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace StockWebHistory.Migrations
{
/// <inheritdoc />
public partial class initialcreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StockEquities",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
StockCode = table.Column<string>(type: "TEXT", nullable: false),
Bought = table.Column<DateTime>(type: "TEXT", nullable: false),
BoughtPrice = table.Column<decimal>(type: "TEXT", nullable: false),
Quantity = table.Column<int>(type: "INTEGER", nullable: false),
Sold = table.Column<DateTime>(type: "TEXT", nullable: false),
SoldPrice = table.Column<decimal>(type: "TEXT", nullable: false),
SoldQuant = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StockEquities", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TransactionNotes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TransactionDate = table.Column<DateTime>(type: "TEXT", nullable: false),
TransactionType = table.Column<string>(type: "TEXT", nullable: true),
StockCode = table.Column<string>(type: "TEXT", nullable: true),
StockPrice = table.Column<decimal>(type: "TEXT", nullable: false),
ExchangeRate = table.Column<decimal>(type: "TEXT", nullable: false),
Currency = table.Column<string>(type: "TEXT", nullable: false),
StockQuantity = table.Column<int>(type: "INTEGER", nullable: false),
TotalAmount = table.Column<decimal>(type: "TEXT", nullable: false),
Commission = table.Column<decimal>(type: "TEXT", nullable: false),
AmountToPay = table.Column<decimal>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TransactionNotes", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_StockEquities_Bought",
table: "StockEquities",
column: "Bought");
migrationBuilder.CreateIndex(
name: "IX_StockEquities_Bought_StockCode_Quantity",
table: "StockEquities",
columns: new[] { "Bought", "StockCode", "Quantity" });
migrationBuilder.CreateIndex(
name: "IX_StockEquities_Sold",
table: "StockEquities",
column: "Sold");
migrationBuilder.CreateIndex(
name: "IX_TransactionNotes_StockCode_TransactionDate",
table: "TransactionNotes",
columns: new[] { "StockCode", "TransactionDate" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StockEquities");
migrationBuilder.DropTable(
name: "TransactionNotes");
}
}
}