Add default value for PaymentType in Walk entity
This commit introduces a default value of `1` for the `PaymentType` property in the `Walk` entity. The `SqlDbContextModelSnapshot.cs` is updated to reflect this change, and the `SqlDbContext.cs` is configured to set the default value to `WalkPaymentType.MangoPay`. A new migration class `Walk_PaymentType_DefaultSet` is created to apply these changes to the database schema, ensuring that new records in the `Walks` table will have a default `PaymentType` of `1`.
This commit is contained in:
parent
fafbc55732
commit
18fc3fb3f2
9480
gehGassi.Persistence/Migrations/20250915133307_Walk_PaymentType_DefaultSet.Designer.cs
generated
Normal file
9480
gehGassi.Persistence/Migrations/20250915133307_Walk_PaymentType_DefaultSet.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace gehGassi.Persistence.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Walk_PaymentType_DefaultSet : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "PaymentType",
|
||||||
|
table: "Walks",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 1,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "PaymentType",
|
||||||
|
table: "Walks",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldDefaultValue: 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7819,7 +7819,9 @@ namespace gehGassi.Persistence.Migrations
|
|||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("PaymentType")
|
b.Property<int>("PaymentType")
|
||||||
.HasColumnType("int");
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasDefaultValue(1);
|
||||||
|
|
||||||
b.Property<Point>("PickupLocation")
|
b.Property<Point>("PickupLocation")
|
||||||
.HasColumnType("geography");
|
.HasColumnType("geography");
|
||||||
|
|||||||
@ -383,6 +383,7 @@ namespace gehGassi.Persistence
|
|||||||
builder.Entity<Walk>().OwnsOne(p => p.ReturnAddress);
|
builder.Entity<Walk>().OwnsOne(p => p.ReturnAddress);
|
||||||
builder.Entity<Walk>().Property(c => c.Price).HasColumnType("decimal(18,2)");
|
builder.Entity<Walk>().Property(c => c.Price).HasColumnType("decimal(18,2)");
|
||||||
builder.Entity<Walk>().Property(c => c.VoucherAmmount).HasColumnType("decimal(18,2)");
|
builder.Entity<Walk>().Property(c => c.VoucherAmmount).HasColumnType("decimal(18,2)");
|
||||||
|
builder.Entity<Walk>().Property(c => c.PaymentType).HasDefaultValue(WalkPaymentType.MangoPay);
|
||||||
|
|
||||||
builder.Entity<WalkComplaint>().HasIndex(c => c.Index);
|
builder.Entity<WalkComplaint>().HasIndex(c => c.Index);
|
||||||
builder.Entity<WalkComplaint>().HasOne<Walk>().WithMany().HasForeignKey(c => c.WalkId).OnDelete(DeleteBehavior.Cascade);
|
builder.Entity<WalkComplaint>().HasOne<Walk>().WithMany().HasForeignKey(c => c.WalkId).OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user