aboutsummaryrefslogtreecommitdiff
path: root/src/Data/DevHive.Data/DevHiveContext.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/DevHive.Data/DevHiveContext.cs')
-rw-r--r--src/Data/DevHive.Data/DevHiveContext.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Data/DevHive.Data/DevHiveContext.cs b/src/Data/DevHive.Data/DevHiveContext.cs
index f8574a4..0606864 100644
--- a/src/Data/DevHive.Data/DevHiveContext.cs
+++ b/src/Data/DevHive.Data/DevHiveContext.cs
@@ -26,9 +26,6 @@ namespace DevHive.Data
.HasIndex(x => x.UserName)
.IsUnique();
- builder.Entity<User>()
- .HasOne(x => x.ProfilePicture);
-
/* Roles */
builder.Entity<User>()
.HasMany(x => x.Roles)
@@ -91,6 +88,15 @@ namespace DevHive.Data
.HasMany(x => x.Ratings)
.WithOne(x => x.Post);
+ /* Profile Picture */
+ builder.Entity<ProfilePicture>()
+ .HasKey(x => x.Id);
+
+ builder.Entity<User>()
+ .HasOne(x => x.ProfilePicture)
+ .WithOne(x => x.User)
+ .HasForeignKey<ProfilePicture>(x => x.UserId);
+
base.OnModelCreating(builder);
}
}