using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace gehGassi.Persistence.Migrations { /// public partial class CardsAdded : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Cards", columns: table => new { Id = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), AppUserId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), MangoPayId = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), MangoPayUserId = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), ExpirationMonth = table.Column(type: "int", nullable: false), ExpirationYear = table.Column(type: "int", nullable: false), CardNumber = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Type = table.Column(type: "int", nullable: false), CardProvider = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Validity = table.Column(type: "int", nullable: false), Currency = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: false), Active = table.Column(type: "bit", 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_Cards", x => x.Id); table.ForeignKey( name: "FK_Cards_AppUsers_AppUserId", column: x => x.AppUserId, principalTable: "AppUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Payouts_AppUserId", table: "Payouts", column: "AppUserId"); migrationBuilder.CreateIndex( name: "IX_IdentityDocuments_AppUserId", table: "IdentityDocuments", column: "AppUserId"); migrationBuilder.CreateIndex( name: "IX_Cards_AppUserId", table: "Cards", column: "AppUserId"); migrationBuilder.CreateIndex( name: "IX_Cards_Index", table: "Cards", column: "Index"); migrationBuilder.AddForeignKey( name: "FK_IdentityDocuments_AppUsers_AppUserId", table: "IdentityDocuments", column: "AppUserId", principalTable: "AppUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Payouts_AppUsers_AppUserId", table: "Payouts", column: "AppUserId", principalTable: "AppUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_IdentityDocuments_AppUsers_AppUserId", table: "IdentityDocuments"); migrationBuilder.DropForeignKey( name: "FK_Payouts_AppUsers_AppUserId", table: "Payouts"); migrationBuilder.DropTable( name: "Cards"); migrationBuilder.DropIndex( name: "IX_Payouts_AppUserId", table: "Payouts"); migrationBuilder.DropIndex( name: "IX_IdentityDocuments_AppUserId", table: "IdentityDocuments"); } } }