using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CMSMicroservice.Infrastructure.Persistence.Migrations { /// public partial class AddDayaLoanIntegration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "DayaCreditReceivedAt", schema: "CMS", table: "Users", type: "datetime2", nullable: true); migrationBuilder.AddColumn( name: "HasReceivedDayaCredit", schema: "CMS", table: "Users", type: "bit", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "DayaLoanContracts", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "bigint", nullable: false), NationalCode = table.Column(type: "nvarchar(max)", nullable: false), ContractNumber = table.Column(type: "nvarchar(max)", nullable: true), Status = table.Column(type: "int", nullable: false), IsProcessed = table.Column(type: "bit", nullable: false), LastCheckDate = table.Column(type: "datetime2", nullable: true), ProcessedDate = table.Column(type: "datetime2", nullable: true), TransactionId = table.Column(type: "bigint", nullable: true), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_DayaLoanContracts", x => x.Id); table.ForeignKey( name: "FK_DayaLoanContracts_Transactionss_TransactionId", column: x => x.TransactionId, principalSchema: "CMS", principalTable: "Transactionss", principalColumn: "Id"); table.ForeignKey( name: "FK_DayaLoanContracts_Users_UserId", column: x => x.UserId, principalSchema: "CMS", principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_DayaLoanContracts_TransactionId", schema: "CMS", table: "DayaLoanContracts", column: "TransactionId"); migrationBuilder.CreateIndex( name: "IX_DayaLoanContracts_UserId", schema: "CMS", table: "DayaLoanContracts", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DayaLoanContracts", schema: "CMS"); migrationBuilder.DropColumn( name: "DayaCreditReceivedAt", schema: "CMS", table: "Users"); migrationBuilder.DropColumn( name: "HasReceivedDayaCredit", schema: "CMS", table: "Users"); } } }