Corrected the migration errors in subscription plan table

This commit is contained in:
ashutosh.nehete 2025-10-28 10:57:42 +05:30
parent 4e171e8ca3
commit 5253ed9a39
5 changed files with 6846 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_PaymentDetails_In_TenantSubscription_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PaymentDetailId",
table: "TenantSubscriptions",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_TenantSubscriptions_PaymentDetailId",
table: "TenantSubscriptions",
column: "PaymentDetailId");
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.DropIndex(
name: "IX_TenantSubscriptions_PaymentDetailId",
table: "TenantSubscriptions");
migrationBuilder.DropColumn(
name: "PaymentDetailId",
table: "TenantSubscriptions");
}
}
}

View File

@ -4706,6 +4706,9 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<DateTime>("NextBillingDate")
.HasColumnType("datetime(6)");
b.Property<Guid?>("PaymentDetailId")
.HasColumnType("char(36)");
b.Property<Guid>("PlanId")
.HasColumnType("char(36)");
@ -4730,6 +4733,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasIndex("CurrencyId");
b.HasIndex("PaymentDetailId");
b.HasIndex("PlanId");
b.HasIndex("StatusId");
@ -6657,6 +6662,10 @@ namespace Marco.Pms.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.PaymentGetway.PaymentDetail", "PaymentDetail")
.WithMany()
.HasForeignKey("PaymentDetailId");
b.HasOne("Marco.Pms.Model.TenantModels.SubscriptionPlanDetails", "Plan")
.WithMany()
.HasForeignKey("PlanId")
@ -6683,6 +6692,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Currency");
b.Navigation("PaymentDetail");
b.Navigation("Plan");
b.Navigation("Status");

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]

View File

@ -944,7 +944,7 @@ namespace Marco.Pms.Services.Controllers
_logger.LogInfo("Tenant enquiry created successfully. ID: {TenantEnquireId}", tenantEnquire.Id);
// Return success response with proper status code and user information
return Ok(ApiResponse<object>.SuccessResponse(model, "Tenant enquiry added successfully.", 201));
return Ok(ApiResponse<object>.SuccessResponse(tenantEnquire, "Tenant enquiry added successfully.", 201));
}
catch (Exception ex)
{