100 lines
4.1 KiB
C#
100 lines
4.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddDayaLoanIntegration : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "DayaCreditReceivedAt",
|
|
schema: "CMS",
|
|
table: "Users",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "HasReceivedDayaCredit",
|
|
schema: "CMS",
|
|
table: "Users",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DayaLoanContracts",
|
|
schema: "CMS",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
UserId = table.Column<long>(type: "bigint", nullable: false),
|
|
NationalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
ContractNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
IsProcessed = table.Column<bool>(type: "bit", nullable: false),
|
|
LastCheckDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
ProcessedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
TransactionId = table.Column<long>(type: "bigint", nullable: true),
|
|
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsDeleted = table.Column<bool>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|