aboutsummaryrefslogtreecommitdiff
path: root/src/Data/DevHive.Data/DevHiveContext.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-04-07 18:41:30 +0300
committertranstrike <transtrike@gmail.com>2021-04-07 18:41:30 +0300
commitb8d1edfc582bee2ef648757bcad1bbadd075bb08 (patch)
tree0042a44c3091af36994cdc9b91a835ed1d803eaa /src/Data/DevHive.Data/DevHiveContext.cs
parentf4eac9c89bef0c21d7ccb29cb0841fa621c79f46 (diff)
parentda7d6223c261aac8e8f18458c11fb48cf9ca4cfe (diff)
downloadDevHive-b8d1edfc582bee2ef648757bcad1bbadd075bb08.tar
DevHive-b8d1edfc582bee2ef648757bcad1bbadd075bb08.tar.gz
DevHive-b8d1edfc582bee2ef648757bcad1bbadd075bb08.zip
Merged from dev
Diffstat (limited to 'src/Data/DevHive.Data/DevHiveContext.cs')
-rw-r--r--src/Data/DevHive.Data/DevHiveContext.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Data/DevHive.Data/DevHiveContext.cs b/src/Data/DevHive.Data/DevHiveContext.cs
index 621336f..0606864 100644
--- a/src/Data/DevHive.Data/DevHiveContext.cs
+++ b/src/Data/DevHive.Data/DevHiveContext.cs
@@ -17,6 +17,7 @@ namespace DevHive.Data
public DbSet<PostAttachments> PostAttachments { get; set; }
public DbSet<Comment> Comments { get; set; }
public DbSet<Rating> Rating { get; set; }
+ public DbSet<ProfilePicture> ProfilePicture { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
@@ -25,11 +26,6 @@ namespace DevHive.Data
.HasIndex(x => x.UserName)
.IsUnique();
- builder.Entity<User>()
- .HasOne(x => x.ProfilePicture)
- .WithOne(x => x.User)
- .HasForeignKey<ProfilePicture>(x => x.UserId);
-
/* Roles */
builder.Entity<User>()
.HasMany(x => x.Roles)
@@ -92,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);
}
}