using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace gehGassi.Persistence.Migrations { /// public partial class CoinsAdded : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "CoinsAccounts", columns: table => new { Id = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), AppUserId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), AppUserType = table.Column(type: "int", nullable: false), Balance = table.Column(type: "decimal(18,2)", nullable: false), Created = table.Column(type: "datetimeoffset", nullable: false), Index = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Version = table.Column(type: "rowversion", rowVersion: true, nullable: true), UpdatedAt = table.Column(type: "datetimeoffset", nullable: false), Deleted = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), AppUserId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), AppUserType = table.Column(type: "int", nullable: false), Year = table.Column(type: "int", nullable: false), Month = table.Column(type: "int", nullable: false), Balance = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), AppUserId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), AppUserType = table.Column(type: "int", nullable: false), Year = table.Column(type: "int", nullable: false), Balance = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TransactionType = table.Column(type: "int", nullable: false), AccountId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), Ammount = table.Column(type: "decimal(18,2)", nullable: false), WalkId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Created = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CoinsPerMonths"); migrationBuilder.DropTable( name: "CoinsPerYears"); migrationBuilder.DropTable( name: "CoinsTransactions"); migrationBuilder.DropTable( name: "CoinsAccounts"); } } }