//
using System;
using BankDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BankDatabaseImplement.Migrations
{
[DbContext(typeof(BankDatabase))]
[Migration("20230407133918_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BankDatabaseImplement.Models.BankOperator", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("MiddleName")
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("BankOperators");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("BankOperatorId")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Percent")
.HasColumnType("real");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.ToTable("CreditPrograms");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreditProgramId")
.HasColumnType("int");
b.Property("CurrencyId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreditProgramId");
b.HasIndex("CurrencyId");
b.ToTable("CreditProgramCurrencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("BankOperatorId")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.ToTable("Currencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CurrencyId")
.HasColumnType("int");
b.Property("PaymentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("PaymentId");
b.ToTable("CurrencyPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("real");
b.Property("BankOperatorId")
.HasColumnType("int");
b.Property("CurrencyId")
.HasColumnType("int");
b.Property("PurchaseDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.HasIndex("CurrencyId");
b.ToTable("CurrencyPurchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("int");
b.Property("CreditProgramId")
.HasColumnType("int");
b.Property("DealDate")
.HasColumnType("datetime2");
b.Property("OperatorId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreditProgramId");
b.HasIndex("OperatorId");
b.ToTable("Deals");
});
modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("DealId")
.HasColumnType("int");
b.Property("PaymentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DealId");
b.HasIndex("PaymentId");
b.ToTable("DealPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Operator", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("MiddleName")
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Operators");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("OperatorId")
.HasColumnType("int");
b.Property("PaymentDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("OperatorId");
b.ToTable("Payments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("real");
b.Property("OperatorId")
.HasColumnType("int");
b.Property("PaymentId")
.HasColumnType("int");
b.Property("TransferDateTime")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("OperatorId");
b.HasIndex("PaymentId");
b.ToTable("Transfers");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
{
b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
.WithMany()
.HasForeignKey("BankOperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BankOperator");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
{
b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram")
.WithMany("Currencies")
.HasForeignKey("CreditProgramId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreditProgram");
b.Navigation("Currency");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
{
b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
.WithMany()
.HasForeignKey("BankOperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BankOperator");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
{
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
.WithMany("Currencies")
.HasForeignKey("PaymentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Currency");
b.Navigation("Payment");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
{
b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
.WithMany()
.HasForeignKey("BankOperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BankOperator");
b.Navigation("Currency");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
{
b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram")
.WithMany()
.HasForeignKey("CreditProgramId");
b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
.WithMany()
.HasForeignKey("OperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreditProgram");
b.Navigation("Operator");
});
modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
{
b.HasOne("BankDatabaseImplement.Models.Deal", "Deal")
.WithMany("DealPayments")
.HasForeignKey("DealId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
.WithMany("Deals")
.HasForeignKey("PaymentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Deal");
b.Navigation("Payment");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
.WithMany()
.HasForeignKey("OperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Operator");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
{
b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
.WithMany()
.HasForeignKey("OperatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
.WithMany()
.HasForeignKey("PaymentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Operator");
b.Navigation("Payment");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
{
b.Navigation("Currencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
{
b.Navigation("DealPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.Navigation("Currencies");
b.Navigation("Deals");
});
#pragma warning restore 612, 618
}
}
}