adding migration for person photo

This commit is contained in:
2025-10-13 22:38:16 +11:00
parent ee19397f59
commit c62ae2cd42
6 changed files with 615 additions and 2 deletions
@@ -21,8 +21,8 @@ namespace FamilyTreeAPI.Models
public virtual DbSet<RelationShip> RelationShips { get; set; } = null!;
public virtual DbSet<Lookup> Lookups { get; set; } = null!;
public virtual DbSet<staff> staff { get; set; } = null!;
public virtual DbSet<PersonPhoto> PersonPhotos { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -74,6 +74,18 @@ namespace FamilyTreeAPI.Models
});
modelBuilder.Entity<PersonPhoto>(entity =>
{
entity.ToTable("personphoto");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.PersonId).HasColumnName("personid");
entity.Property(e => e.Photo).HasColumnName("photo");
entity.Property(e => e.ImagePhoto).HasColumnName("imagephot"); //try to store binary in table. "bytea"
});
modelBuilder.Entity<Lookup>(entity =>
{
entity.ToTable("lookup");
+13
View File
@@ -0,0 +1,13 @@
namespace FamilyTreeAPI.Models
{
public class PersonPhoto
{
public int Id { get; set; }
public int PersonId { get; set; }
public string Photo { get; set; }
public byte[] ImagePhoto { get; set; }
}
}