//
using System;
using AAIntegration.SimmonsBank.API.Config;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AAIntegration.SimmonsBank.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20240320022712_UserOwnedEntities")]
partial class UserOwnedEntities
{
///
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("ExternalAccountNumber")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("OwnerId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Accounts");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Transaction", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("numeric");
b.Property("CreatedOn")
.HasColumnType("timestamp with time zone");
b.Property("CreditAccountId")
.HasColumnType("integer");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("DebitAccountId")
.HasColumnType("integer");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("ExternalId")
.IsRequired()
.HasColumnType("text");
b.Property("IsPending")
.HasColumnType("boolean");
b.Property("OwnerId")
.HasColumnType("integer");
b.Property("UpdatedOn")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CreditAccountId");
b.HasIndex("DebitAccountId");
b.HasIndex("OwnerId");
b.ToTable("Transactions");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ApiKey")
.IsRequired()
.HasColumnType("text");
b.Property("MFAKey")
.IsRequired()
.HasColumnType("text");
b.Property("SimmonsBankPassword")
.IsRequired()
.HasColumnType("text");
b.Property("SimmonsBankUsername")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Account", b =>
{
b.HasOne("AAIntegration.SimmonsBank.API.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("AAIntegration.SimmonsBank.API.Entities.Transaction", b =>
{
b.HasOne("AAIntegration.SimmonsBank.API.Entities.Account", "CreditAccount")
.WithMany()
.HasForeignKey("CreditAccountId");
b.HasOne("AAIntegration.SimmonsBank.API.Entities.Account", "DebitAccount")
.WithMany()
.HasForeignKey("DebitAccountId");
b.HasOne("AAIntegration.SimmonsBank.API.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreditAccount");
b.Navigation("DebitAccount");
b.Navigation("Owner");
});
#pragma warning restore 612, 618
}
}
}