gehgassi_backend/gehGassi.Persistence/Migrations/20231026094744_CoinsAdded.cs

151 lines
6.6 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace gehGassi.Persistence.Migrations
{
/// <inheritdoc />
public partial class CoinsAdded : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CoinsAccounts",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
AppUserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
AppUserType = table.Column<int>(type: "int", nullable: false),
Balance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Created = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
Index = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Version = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
Deleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CoinsAccounts", x => x.Id);
table.ForeignKey(
name: "FK_CoinsAccounts_AppUsers_AppUserId",
column: x => x.AppUserId,
principalTable: "AppUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CoinsPerMonths",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AppUserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
AppUserType = table.Column<int>(type: "int", nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
Month = table.Column<int>(type: "int", nullable: false),
Balance = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CoinsPerMonths", x => x.Id);
table.ForeignKey(
name: "FK_CoinsPerMonths_AppUsers_AppUserId",
column: x => x.AppUserId,
principalTable: "AppUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CoinsPerYears",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AppUserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
AppUserType = table.Column<int>(type: "int", nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
Balance = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CoinsPerYears", x => x.Id);
table.ForeignKey(
name: "FK_CoinsPerYears_AppUsers_AppUserId",
column: x => x.AppUserId,
principalTable: "AppUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CoinsTransactions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TransactionType = table.Column<int>(type: "int", nullable: false),
AccountId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Ammount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
WalkId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Created = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CoinsTransactions", x => x.Id);
table.ForeignKey(
name: "FK_CoinsTransactions_CoinsAccounts_AccountId",
column: x => x.AccountId,
principalTable: "CoinsAccounts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CoinsAccounts_AppUserId",
table: "CoinsAccounts",
column: "AppUserId");
migrationBuilder.CreateIndex(
name: "IX_CoinsAccounts_Index",
table: "CoinsAccounts",
column: "Index");
migrationBuilder.CreateIndex(
name: "IX_CoinsPerMonths_AppUserId",
table: "CoinsPerMonths",
column: "AppUserId");
migrationBuilder.CreateIndex(
name: "IX_CoinsPerYears_AppUserId",
table: "CoinsPerYears",
column: "AppUserId");
migrationBuilder.CreateIndex(
name: "IX_CoinsTransactions_AccountId",
table: "CoinsTransactions",
column: "AccountId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CoinsPerMonths");
migrationBuilder.DropTable(
name: "CoinsPerYears");
migrationBuilder.DropTable(
name: "CoinsTransactions");
migrationBuilder.DropTable(
name: "CoinsAccounts");
}
}
}