// using System; using BlogDatabase; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace BlogDatabase.Migrations { [DbContext(typeof(BlogDatabase))] [Migration("20230906180114_mig4")] partial class mig4 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "7.0.5") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("BlogDatabase.Models.Category", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.ToTable("Categories"); }); modelBuilder.Entity("BlogDatabase.Models.Message", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Date") .HasColumnType("timestamp with time zone"); b.Property("Text") .IsRequired() .HasColumnType("text"); b.Property("TopicId") .HasColumnType("integer"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("TopicId"); b.HasIndex("UserId"); b.ToTable("Messages"); }); modelBuilder.Entity("BlogDatabase.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("BlogDatabase.Models.Topic", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CategoryId") .HasColumnType("integer"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("CategoryId"); b.ToTable("Topics"); }); modelBuilder.Entity("BlogDatabase.Models.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Email") .IsRequired() .HasColumnType("text"); b.Property("Password") .IsRequired() .HasColumnType("text"); b.Property("RegistrationDate") .HasColumnType("timestamp with time zone"); b.Property("RoleId") .HasColumnType("integer"); b.Property("Username") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("RoleId"); b.ToTable("Users"); }); modelBuilder.Entity("BlogDatabase.Models.Message", b => { b.HasOne("BlogDatabase.Models.Topic", "Topic") .WithMany() .HasForeignKey("TopicId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("BlogDatabase.Models.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Topic"); b.Navigation("User"); }); modelBuilder.Entity("BlogDatabase.Models.Topic", b => { b.HasOne("BlogDatabase.Models.Category", "Category") .WithMany() .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Category"); }); modelBuilder.Entity("BlogDatabase.Models.User", b => { b.HasOne("BlogDatabase.Models.Role", "Role") .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Role"); }); #pragma warning restore 612, 618 } } }