Currency creation and minting with basis of transactions

This commit is contained in:
2023-08-19 15:04:10 -04:00
parent 401c75a4f9
commit 658bd7ca2a
13 changed files with 594 additions and 34 deletions

View File

@ -0,0 +1,98 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IO.Swagger.Migrations
{
/// <inheritdoc />
public partial class Startedtransactionsandcurrencies : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Currencies",
columns: table => new
{
CurrencyId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
Symbol = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
UserId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Currencies", x => x.CurrencyId);
table.ForeignKey(
name: "FK_Currencies_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Transactions",
columns: table => new
{
TransactionId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FromUserId = table.Column<int>(type: "int", nullable: false),
ToUserId = table.Column<int>(type: "int", nullable: false),
Amount = table.Column<float>(type: "real", nullable: false),
Memo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
CurrencyId = table.Column<int>(type: "int", nullable: false),
TransactionTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Transactions", x => x.TransactionId);
table.ForeignKey(
name: "FK_Transactions_Currencies_CurrencyId",
column: x => x.CurrencyId,
principalTable: "Currencies",
principalColumn: "CurrencyId");
table.ForeignKey(
name: "FK_Transactions_Users_FromUserId",
column: x => x.FromUserId,
principalTable: "Users",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Transactions_Users_ToUserId",
column: x => x.ToUserId,
principalTable: "Users",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Currencies_UserId",
table: "Currencies",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_CurrencyId",
table: "Transactions",
column: "CurrencyId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_FromUserId",
table: "Transactions",
column: "FromUserId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_ToUserId",
table: "Transactions",
column: "ToUserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Transactions");
migrationBuilder.DropTable(
name: "Currencies");
}
}
}