Make the payment details nullable

This commit is contained in:
ashutosh.nehete 2025-10-28 10:41:52 +05:30
parent 1a360447cd
commit 7273f49b3f
4 changed files with 6850 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Make_PaymentDetails_In_TenantSubscription_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TenantSubscriptions_PaymentDetails_PaymentDetailId",
table: "TenantSubscriptions");
migrationBuilder.AlterColumn<Guid>(
name: "PaymentDetailId",
table: "TenantSubscriptions",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_TenantSubscriptions_PaymentDetails_PaymentDetailId",
table: "TenantSubscriptions",
column: "PaymentDetailId",
principalTable: "PaymentDetails",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TenantSubscriptions_PaymentDetails_PaymentDetailId",
table: "TenantSubscriptions");
migrationBuilder.AlterColumn<Guid>(
name: "PaymentDetailId",
table: "TenantSubscriptions",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_TenantSubscriptions_PaymentDetails_PaymentDetailId",
table: "TenantSubscriptions",
column: "PaymentDetailId",
principalTable: "PaymentDetails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -4706,7 +4706,7 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<DateTime>("NextBillingDate")
.HasColumnType("datetime(6)");
b.Property<Guid>("PaymentDetailId")
b.Property<Guid?>("PaymentDetailId")
.HasColumnType("char(36)");
b.Property<Guid>("PlanId")
@ -6664,9 +6664,7 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasOne("Marco.Pms.Model.PaymentGetway.PaymentDetail", "PaymentDetail")
.WithMany()
.HasForeignKey("PaymentDetailId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("PaymentDetailId");
b.HasOne("Marco.Pms.Model.TenantModels.SubscriptionPlanDetails", "Plan")
.WithMany()

View File

@ -33,7 +33,7 @@ namespace Marco.Pms.Model.TenantModels
public DateTime? CancellationDate { get; set; }
public bool AutoRenew { get; set; } = true;
public bool IsCancelled { get; set; } = false;
public Guid PaymentDetailId { get; set; }
public Guid? PaymentDetailId { get; set; }
[ForeignKey("PaymentDetailId")]
[ValidateNever]