//
using System;
using BulletinBoardDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BulletinBoardDatabase.Migrations
{
[DbContext(typeof(BulletinBoardDatabase))]
[Migration("20240405213513_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BulletinBoardDatabase.Models.Announcement", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CategoryId")
.IsRequired()
.HasColumnType("integer");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("RegionId")
.IsRequired()
.HasColumnType("integer");
b.Property("ReviewRating")
.HasColumnType("integer");
b.Property("ReviewText")
.HasColumnType("text");
b.Property("StartDate")
.HasColumnType("timestamp with time zone");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.IsRequired()
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("RegionId");
b.HasIndex("UserId");
b.ToTable("Announcements");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.Category", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.City", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CityId")
.HasColumnType("integer");
b.Property("CityName")
.IsRequired()
.HasColumnType("text");
b.Property("RegionId")
.IsRequired()
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("Cities");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.Region", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("RegionName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Regions");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.Property("Surname")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.Announcement", b =>
{
b.HasOne("BulletinBoardDatabase.Models.Category", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BulletinBoardDatabase.Models.Region", "Region")
.WithMany()
.HasForeignKey("RegionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BulletinBoardDatabase.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
b.Navigation("Region");
b.Navigation("User");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.City", b =>
{
b.HasOne("BulletinBoardDatabase.Models.Region", "Region")
.WithMany("Cities")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Region");
});
modelBuilder.Entity("BulletinBoardDatabase.Models.Region", b =>
{
b.Navigation("Cities");
});
#pragma warning restore 612, 618
}
}
}