//
using System;
using AvaloniaApplication2.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AvaloniaPractic.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20241010095341_UpdateUsersAndLoginedTables")]
partial class UpdateUsersAndLoginedTables
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("AvaloniaApplication2.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Createdat")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp without time zone")
.HasColumnName("createdat")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("email");
b.Property("Username")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasColumnName("username");
b.HasKey("Id")
.HasName("users_pkey");
b.ToTable("users", (string)null);
});
modelBuilder.Entity("AvaloniaPractic.Models.Logined", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Login")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("RoleId")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("Logins");
});
modelBuilder.Entity("AvaloniaPractic.Models.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("AvaloniaPractic.Models.Logined", b =>
{
b.HasOne("AvaloniaPractic.Models.Role", "Role")
.WithMany("Logins")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AvaloniaApplication2.Models.User", "User")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
modelBuilder.Entity("AvaloniaApplication2.Models.User", b =>
{
b.Navigation("Logins");
});
modelBuilder.Entity("AvaloniaPractic.Models.Role", b =>
{
b.Navigation("Logins");
});
#pragma warning restore 612, 618
}
}
}