//
using System;
using FarmatikoData;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FarmatikoData.Migrations
{
[DbContext(typeof(FarmatikoDataContext))]
[Migration("20210208041424_Initial-Create")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "3.1.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("FarmatikoData.Models.HealthFacility", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("Address")
.IsRequired()
.HasColumnType("text");
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("Email")
.HasColumnType("text");
b.Property("Municipality")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Phone")
.HasColumnType("text");
b.Property("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("HealthFacilities");
});
modelBuilder.Entity("FarmatikoData.Models.HealthcareWorker", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("Branch")
.IsRequired()
.HasColumnType("text");
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("FacilityId")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("FacilityId");
b.ToTable("HealthcareWorkers");
});
modelBuilder.Entity("FarmatikoData.Models.Medicine", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("Form")
.HasColumnType("text");
b.Property("Manufacturer")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Packaging")
.HasColumnType("text");
b.Property("Price")
.HasColumnType("real");
b.Property("Strength")
.IsRequired()
.HasColumnType("text");
b.Property("WayOfIssuing")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Medicines");
});
modelBuilder.Entity("FarmatikoData.Models.Pandemic", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("ActiveGlobal")
.HasColumnType("bigint");
b.Property("ActiveMK")
.HasColumnType("integer");
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeathsGlobal")
.HasColumnType("bigint");
b.Property("DeathsMK")
.HasColumnType("integer");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("NewMK")
.HasColumnType("integer");
b.Property("TotalGlobal")
.HasColumnType("bigint");
b.Property("TotalMK")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Pandemics");
});
modelBuilder.Entity("FarmatikoData.Models.Pharmacy", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("Address")
.IsRequired()
.HasColumnType("text");
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("Location")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("PheadId")
.HasColumnType("integer");
b.Property("WorkAllTime")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("PheadId");
b.ToTable("Pharmacies");
});
modelBuilder.Entity("FarmatikoData.Models.PharmacyHead", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("UserID")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserID");
b.ToTable("PharmacyHeads");
});
modelBuilder.Entity("FarmatikoData.Models.PharmacyHeadMedicine", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("HeadId")
.HasColumnType("integer");
b.Property("MedicineId")
.HasColumnType("integer");
b.Property("PheadId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HeadId");
b.HasIndex("MedicineId");
b.ToTable("PharmacyHeadMedicines");
});
modelBuilder.Entity("FarmatikoData.Models.RequestPharmacyHead", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("HeadId")
.HasColumnType("integer");
b.Property("PharmacyId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HeadId");
b.HasIndex("PharmacyId");
b.ToTable("PHRequests");
});
modelBuilder.Entity("FarmatikoData.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
b.Property("CreatedOn")
.HasColumnType("timestamp without time zone");
b.Property("DeletedOn")
.HasColumnType("timestamp without time zone");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("UserRole")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("FarmatikoData.Models.HealthcareWorker", b =>
{
b.HasOne("FarmatikoData.Models.HealthFacility", "Facility")
.WithMany()
.HasForeignKey("FacilityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FarmatikoData.Models.Pharmacy", b =>
{
b.HasOne("FarmatikoData.Models.PharmacyHead", "PharmacyHead")
.WithMany("Pharmacies")
.HasForeignKey("PheadId");
});
modelBuilder.Entity("FarmatikoData.Models.PharmacyHead", b =>
{
b.HasOne("FarmatikoData.Models.User", "User")
.WithMany()
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FarmatikoData.Models.PharmacyHeadMedicine", b =>
{
b.HasOne("FarmatikoData.Models.PharmacyHead", "Head")
.WithMany("Medicines")
.HasForeignKey("HeadId");
b.HasOne("FarmatikoData.Models.Medicine", "Medicine")
.WithMany("Medicines")
.HasForeignKey("MedicineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FarmatikoData.Models.RequestPharmacyHead", b =>
{
b.HasOne("FarmatikoData.Models.PharmacyHead", "Head")
.WithMany()
.HasForeignKey("HeadId");
b.HasOne("FarmatikoData.Models.Pharmacy", "Pharmacy")
.WithMany()
.HasForeignKey("PharmacyId");
});
#pragma warning restore 612, 618
}
}
}