//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using AAIntegration.SimmonsBank.API.Config;
#nullable disable
namespace AAIntegration.SimmonsBank.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20231201042238_AccountsAllocsOperations")]
partial class AccountsAllocsOperations
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Account", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Balance")
.HasColumnType("numeric");
b.Property("CreatedOn")
.HasColumnType("timestamp with time zone");
b.Property("CurrencyId")
.HasColumnType("integer");
b.Property("ExternalAccountNumber")
.IsRequired()
.HasColumnType("text");
b.Property("InitialBalance")
.HasColumnType("numeric");
b.Property("LastActivity")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("OwnerId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("OwnerId");
b.ToTable("Accounts");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Alloc", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AccountId")
.HasColumnType("integer");
b.Property("CurrentBalance")
.HasColumnType("numeric");
b.Property("Enabled")
.HasColumnType("boolean");
b.Property("LastBalanceAdded")
.HasColumnType("numeric");
b.Property("LastTriggeredOn")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Period")
.HasColumnType("interval");
b.Property("PersistanceEnabled")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("AccountId");
b.ToTable("Allocs");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.CurrencyType", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Code")
.IsRequired()
.HasColumnType("text");
b.Property("DecimalPlaces")
.HasColumnType("integer");
b.Property("Symbol")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("CurrencyTypes");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Operation", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AbsoluteValue")
.HasColumnType("numeric");
b.Property("AllocId")
.HasColumnType("integer");
b.Property("Enabled")
.HasColumnType("boolean");
b.Property("HistoricLookbackDepth")
.HasColumnType("integer");
b.Property("HistoricPeriod")
.HasColumnType("interval");
b.Property("HistoricStatistic")
.HasColumnType("integer");
b.Property("Mode")
.HasColumnType("integer");
b.Property("Negative")
.HasColumnType("boolean");
b.Property("Order")
.HasColumnType("integer");
b.Property("Percentage")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("AllocId");
b.ToTable("Operations");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("LastName")
.IsRequired()
.HasColumnType("text");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("Role")
.HasColumnType("integer");
b.Property("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Account", b =>
{
b.HasOne("AAIntegration.SimmonsBank.API.Entities.CurrencyType", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AAIntegration.SimmonsBank.API.Entities.User", "Owner")
.WithMany("Accounts")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Currency");
b.Navigation("Owner");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Alloc", b =>
{
b.HasOne("AAIntegration.SimmonsBank.API.Entities.Account", "Account")
.WithMany("Allocs")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Account");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Operation", b =>
{
b.HasOne("AAIntegration.SimmonsBank.API.Entities.Alloc", null)
.WithMany("Operations")
.HasForeignKey("AllocId");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Account", b =>
{
b.Navigation("Allocs");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Alloc", b =>
{
b.Navigation("Operations");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.User", b =>
{
b.Navigation("Accounts");
});
#pragma warning restore 612, 618
}
}
}