//
using System;
using Gateway.POS;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Gateway.POS.Migrations
{
[DbContext(typeof(PosAppDbContext))]
[Migration("20210526091426_addSourceTrxIdToRedeemAndRecharge")]
partial class addSourceTrxIdToRedeemAndRecharge
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.5");
modelBuilder.Entity("Gateway.POS.Models.AppliedDiscount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("DiscountId")
.HasColumnType("INTEGER");
b.Property("DiscountedAmount")
.HasColumnType("TEXT");
b.Property("TransactionId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DiscountId");
b.HasIndex("TransactionId");
b.ToTable("AppliedDiscount");
});
modelBuilder.Entity("Gateway.POS.Models.Discount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Command")
.HasColumnType("TEXT");
b.Property("CreatedTime")
.HasColumnType("TEXT");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("DiscountType")
.HasColumnType("INTEGER");
b.Property("EndTime")
.HasColumnType("TEXT");
b.Property("IsMarkedAsDeletion")
.HasColumnType("INTEGER");
b.Property("ModifiedTime")
.HasColumnType("TEXT");
b.Property("Name")
.HasColumnType("TEXT");
b.Property("StartTime")
.HasColumnType("TEXT");
b.Property("TargetFuelProductCode")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Discounts");
});
modelBuilder.Entity("Gateway.POS.Models.FuelItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Amount")
.HasColumnType("REAL");
b.Property("FuelProductCode")
.HasColumnType("TEXT");
b.Property("FuelProductName")
.HasColumnType("TEXT");
b.Property("FuelTrxSequenceNumber")
.HasColumnType("TEXT");
b.Property("FuelingEndTime")
.HasColumnType("TEXT");
b.Property("FuelingStartTime")
.HasColumnType("TEXT");
b.Property("NozzleLogicalId")
.HasColumnType("INTEGER");
b.Property("Price")
.HasColumnType("REAL");
b.Property("PumpId")
.HasColumnType("INTEGER");
b.Property("Qualtity")
.HasColumnType("REAL");
b.Property("SiteLevelNozzleId")
.HasColumnType("INTEGER");
b.Property("TotalVolume")
.HasColumnType("REAL");
b.Property("TransactionId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Amount");
b.HasIndex("FuelProductCode");
b.HasIndex("SiteLevelNozzleId");
b.HasIndex("TransactionId");
b.HasIndex("PumpId", "NozzleLogicalId");
b.ToTable("FuelItems");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Address")
.HasColumnType("TEXT");
b.Property("Age")
.HasColumnType("INTEGER");
b.Property("AllowSubAccountAccessProfitAccounts")
.HasColumnType("INTEGER");
b.Property("Birth")
.HasColumnType("TEXT");
b.Property("ClientSideTimestamp")
.HasColumnType("TEXT");
b.Property("CompanyName")
.HasColumnType("TEXT");
b.Property("ConsumeRestrictionComplexData")
.HasColumnType("TEXT");
b.Property("CreateByOperatorId")
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("Email")
.HasColumnType("TEXT");
b.Property("EnableProfitAccountBalanceChangeNotify")
.HasColumnType("INTEGER");
b.Property("InvoiceCompanyName")
.HasColumnType("TEXT");
b.Property("InvoiceTaxNumber")
.HasColumnType("TEXT");
b.Property("IsMale")
.HasColumnType("INTEGER");
b.Property("MembershipLevel")
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property("PhoneNumber")
.HasColumnType("TEXT");
b.Property("ServerSideCreatedTimestamp")
.HasColumnType("TEXT");
b.Property("ServerSideLastModifiedTimestamp")
.HasColumnType("TEXT");
b.Property("SuspendStateEndTime")
.HasColumnType("TEXT");
b.Property("SuspendStateStartTime")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreateByOperatorId");
b.HasIndex("Name", "CompanyName", "PhoneNumber");
b.ToTable("MembershipAccounts");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipAccount_M2M_MembershipTag", b =>
{
b.Property("MembershipTagId")
.HasColumnType("INTEGER");
b.Property("MembershipAccountId")
.HasColumnType("INTEGER");
b.HasKey("MembershipTagId", "MembershipAccountId");
b.HasIndex("MembershipAccountId");
b.ToTable("MembershipAccount_M2M_MembershipTags");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Balance")
.HasColumnType("REAL");
b.Property("BalanceComplexData")
.HasColumnType("TEXT");
b.Property("MembershipAccountId")
.HasColumnType("INTEGER");
b.Property("MembershipSubAccountId")
.HasColumnType("INTEGER");
b.Property("ProfitType")
.HasColumnType("INTEGER");
b.Property("RedeemAuthMode")
.HasColumnType("INTEGER");
b.Property("RedeemAuthPassword")
.HasColumnType("TEXT");
b.Property("ServerSideCreatedTimestamp")
.HasColumnType("TEXT");
b.Property("ServerSideLastModifiedTimestamp")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MembershipAccountId");
b.HasIndex("MembershipSubAccountId");
b.ToTable("MembershipProfitAccounts");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccountRecharge", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CreateByOperatorId")
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("InvoiceIssuedDateTime")
.HasColumnType("TEXT");
b.Property("MembershipProfitAccountId")
.HasColumnType("INTEGER");
b.Property("ProfitAccountAmountBalance")
.HasColumnType("TEXT");
b.Property("RechargeAmount")
.HasColumnType("REAL");
b.Property("RechargeSource")
.HasColumnType("INTEGER");
b.Property("SourceTrxId")
.HasColumnType("INTEGER");
b.Property("Timestamp")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreateByOperatorId");
b.HasIndex("MembershipProfitAccountId");
b.HasIndex("SourceTrxId")
.IsUnique();
b.ToTable("MembershipProfitAccountRecharges");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccountRedeem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CreateByOperatorId")
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("MembershipProfitAccountId")
.HasColumnType("INTEGER");
b.Property("ProfitAccountAmountBalance")
.HasColumnType("TEXT");
b.Property("Purpose")
.HasColumnType("TEXT");
b.Property("RedeemedProfitAmount")
.HasColumnType("REAL");
b.Property("RedeemedProfitComplexData")
.HasColumnType("TEXT");
b.Property("SourceTrxId")
.HasColumnType("INTEGER");
b.Property("Timestamp")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreateByOperatorId");
b.HasIndex("MembershipProfitAccountId");
b.HasIndex("SourceTrxId")
.IsUnique();
b.ToTable("MembershipProfitAccountRedeems");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("AccountState")
.HasColumnType("INTEGER");
b.Property("ConsumeRestrictionComplexData")
.HasColumnType("TEXT");
b.Property("CreateByOperatorId")
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("EnableProfitAccountBalanceChangeNotify")
.HasColumnType("INTEGER");
b.Property("LastAccountStateUpdateReason")
.HasColumnType("TEXT");
b.Property("LastAccountStateUpdateTime")
.HasColumnType("TEXT");
b.Property("MembershipAccountId")
.HasColumnType("INTEGER");
b.Property("MembershipLevel")
.HasColumnType("INTEGER");
b.Property("ServerSideCreatedTimestamp")
.HasColumnType("TEXT");
b.Property("ServerSideLastModifiedTimestamp")
.HasColumnType("TEXT");
b.Property("SubAccountHolderAddress")
.HasColumnType("TEXT");
b.Property("SubAccountHolderEmail")
.HasColumnType("TEXT");
b.Property("SubAccountHolderName")
.HasColumnType("TEXT");
b.Property("SubAccountHolderPhoneNumber")
.HasColumnType("TEXT");
b.Property("SuspendStateEndTime")
.HasColumnType("TEXT");
b.Property("SuspendStateStartTime")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreateByOperatorId");
b.HasIndex("MembershipAccountId");
b.ToTable("MembershipSubAccounts");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccountIdentity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("Identity")
.HasColumnType("TEXT");
b.Property("IdentityCarrierType")
.HasColumnType("INTEGER");
b.Property("MembershipSubAccountId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("MembershipSubAccountId", "Identity", "IdentityCarrierType")
.IsUnique();
b.ToTable("MembershipSubAccountIdentities");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccount_M2M_MembershipTag", b =>
{
b.Property("MembershipTagId")
.HasColumnType("INTEGER");
b.Property("MembershipSubAccountId")
.HasColumnType("INTEGER");
b.HasKey("MembershipTagId", "MembershipSubAccountId");
b.HasIndex("MembershipSubAccountId");
b.ToTable("MembershipSubAccount_M2M_MembershipTags");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipTag", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("Name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("MembershipTags");
});
modelBuilder.Entity("Gateway.POS.Models.Operator", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CreatedTimestamp")
.HasColumnType("TEXT");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("Name")
.HasColumnType("TEXT");
b.Property("Password")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Operators");
});
modelBuilder.Entity("Gateway.POS.Models.Payment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("AuthCode")
.HasColumnType("TEXT");
b.Property("BillNumber")
.HasColumnType("TEXT");
b.Property("CardReaderName")
.HasColumnType("TEXT");
b.Property("Comment")
.HasColumnType("TEXT");
b.Property("ExpectAmount")
.HasColumnType("REAL");
b.Property("Method")
.HasColumnType("INTEGER");
b.Property("PaidAmount")
.HasColumnType("REAL");
b.Property("TargetMembershipAccountId")
.HasColumnType("INTEGER");
b.Property("TargetMembershipSubAccountId")
.HasColumnType("INTEGER");
b.Property("TradeStatus")
.HasColumnType("INTEGER");
b.Property("TransactionId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("TransactionId");
b.ToTable("Payments");
});
modelBuilder.Entity("Gateway.POS.Models.Transaction", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("ClientSideTimestamp")
.HasColumnType("TEXT");
b.Property("Comment")
.HasColumnType("TEXT");
b.Property("MembershipProfitAccountRechargeId")
.HasColumnType("INTEGER");
b.Property("MembershipProfitAccountRedeemId")
.HasColumnType("INTEGER");
b.Property("NetAmount")
.HasColumnType("REAL");
b.Property("OperatorId")
.HasColumnType("INTEGER");
b.Property("ReceiptId")
.HasColumnType("TEXT");
b.Property("ServerSideTimestamp")
.HasColumnType("TEXT");
b.Property("ShiftId")
.HasColumnType("TEXT");
b.Property("SiteId")
.HasColumnType("TEXT");
b.Property("TerminalId")
.HasColumnType("TEXT");
b.Property("TotalAmount")
.HasColumnType("REAL");
b.Property("TransactionSubType")
.HasColumnType("INTEGER");
b.Property("TransactionType")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("NetAmount");
b.HasIndex("OperatorId");
b.HasIndex("ReceiptId")
.IsUnique();
b.HasIndex("ServerSideTimestamp");
b.HasIndex("ShiftId");
b.HasIndex("TotalAmount");
b.ToTable("Transactions");
});
modelBuilder.Entity("Gateway.POS.Models.AppliedDiscount", b =>
{
b.HasOne("Gateway.POS.Models.Discount", "Discount")
.WithMany()
.HasForeignKey("DiscountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Gateway.POS.Models.Transaction", null)
.WithMany("AppliedDiscounts")
.HasForeignKey("TransactionId");
b.Navigation("Discount");
});
modelBuilder.Entity("Gateway.POS.Models.FuelItem", b =>
{
b.HasOne("Gateway.POS.Models.Transaction", "Transaction")
.WithMany("FuelItems")
.HasForeignKey("TransactionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Transaction");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipAccount", b =>
{
b.HasOne("Gateway.POS.Models.Operator", "CreateByOperator")
.WithMany()
.HasForeignKey("CreateByOperatorId");
b.Navigation("CreateByOperator");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipAccount_M2M_MembershipTag", b =>
{
b.HasOne("Gateway.POS.Models.MembershipAccount", "Account")
.WithMany("AccountTags")
.HasForeignKey("MembershipAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Gateway.POS.Models.MembershipTag", "Tag")
.WithMany("AccountTags")
.HasForeignKey("MembershipTagId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Account");
b.Navigation("Tag");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccount", b =>
{
b.HasOne("Gateway.POS.Models.MembershipAccount", "Account")
.WithMany("ProfitAccounts")
.HasForeignKey("MembershipAccountId");
b.HasOne("Gateway.POS.Models.MembershipSubAccount", "SubAccount")
.WithMany("ProfitAccounts")
.HasForeignKey("MembershipSubAccountId");
b.Navigation("Account");
b.Navigation("SubAccount");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccountRecharge", b =>
{
b.HasOne("Gateway.POS.Models.Operator", "CreateByOperator")
.WithMany()
.HasForeignKey("CreateByOperatorId");
b.HasOne("Gateway.POS.Models.MembershipProfitAccount", "ProfitAccount")
.WithMany("ProfitRecharges")
.HasForeignKey("MembershipProfitAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Gateway.POS.Models.Transaction", "SourceTrx")
.WithOne("MembershipProfitAccountRecharge")
.HasForeignKey("Gateway.POS.Models.MembershipProfitAccountRecharge", "SourceTrxId");
b.Navigation("CreateByOperator");
b.Navigation("ProfitAccount");
b.Navigation("SourceTrx");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccountRedeem", b =>
{
b.HasOne("Gateway.POS.Models.Operator", "CreateByOperator")
.WithMany()
.HasForeignKey("CreateByOperatorId");
b.HasOne("Gateway.POS.Models.MembershipProfitAccount", "ProfitAccount")
.WithMany("ProfitRedeems")
.HasForeignKey("MembershipProfitAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Gateway.POS.Models.Transaction", "SourceTrx")
.WithOne("MembershipProfitAccountRedeem")
.HasForeignKey("Gateway.POS.Models.MembershipProfitAccountRedeem", "SourceTrxId");
b.Navigation("CreateByOperator");
b.Navigation("ProfitAccount");
b.Navigation("SourceTrx");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccount", b =>
{
b.HasOne("Gateway.POS.Models.Operator", "CreateByOperator")
.WithMany("OperatorCards")
.HasForeignKey("CreateByOperatorId");
b.HasOne("Gateway.POS.Models.MembershipAccount", "Account")
.WithMany("SubAccounts")
.HasForeignKey("MembershipAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Account");
b.Navigation("CreateByOperator");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccountIdentity", b =>
{
b.HasOne("Gateway.POS.Models.MembershipSubAccount", "SubAccount")
.WithMany("Identities")
.HasForeignKey("MembershipSubAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SubAccount");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccount_M2M_MembershipTag", b =>
{
b.HasOne("Gateway.POS.Models.MembershipSubAccount", "SubAccount")
.WithMany("SubAccountTags")
.HasForeignKey("MembershipSubAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Gateway.POS.Models.MembershipTag", "Tag")
.WithMany("SubAccountTags")
.HasForeignKey("MembershipTagId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SubAccount");
b.Navigation("Tag");
});
modelBuilder.Entity("Gateway.POS.Models.Payment", b =>
{
b.HasOne("Gateway.POS.Models.Transaction", "Transaction")
.WithMany("Payments")
.HasForeignKey("TransactionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Transaction");
});
modelBuilder.Entity("Gateway.POS.Models.Transaction", b =>
{
b.HasOne("Gateway.POS.Models.Operator", "Operator")
.WithMany()
.HasForeignKey("OperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Operator");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipAccount", b =>
{
b.Navigation("AccountTags");
b.Navigation("ProfitAccounts");
b.Navigation("SubAccounts");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipProfitAccount", b =>
{
b.Navigation("ProfitRecharges");
b.Navigation("ProfitRedeems");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipSubAccount", b =>
{
b.Navigation("Identities");
b.Navigation("ProfitAccounts");
b.Navigation("SubAccountTags");
});
modelBuilder.Entity("Gateway.POS.Models.MembershipTag", b =>
{
b.Navigation("AccountTags");
b.Navigation("SubAccountTags");
});
modelBuilder.Entity("Gateway.POS.Models.Operator", b =>
{
b.Navigation("OperatorCards");
});
modelBuilder.Entity("Gateway.POS.Models.Transaction", b =>
{
b.Navigation("AppliedDiscounts");
b.Navigation("FuelItems");
b.Navigation("MembershipProfitAccountRecharge");
b.Navigation("MembershipProfitAccountRedeem");
b.Navigation("Payments");
});
#pragma warning restore 612, 618
}
}
}