mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-03 17:42:36 +00:00
Update C# db models
This commit is contained in:
@@ -294,7 +294,13 @@ public partial class SpacebarDbContext : DbContext
|
||||
|
||||
entity.Property(e => e.Id).ValueGeneratedNever();
|
||||
|
||||
entity.HasOne(d => d.Guild).WithMany(p => p.Emojis).HasConstraintName("FK_4b988e0db89d94cebcf07f598cc");
|
||||
entity.HasOne(d => d.Application).WithMany(p => p.Emojis)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_emoji_application_id");
|
||||
|
||||
entity.HasOne(d => d.Guild).WithMany(p => p.Emojis)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_emoji_guild_id");
|
||||
|
||||
entity.HasOne(d => d.User).WithMany(p => p.Emojis).HasConstraintName("FK_fa7ddd5f9a214e28ce596548421");
|
||||
});
|
||||
|
||||
@@ -108,6 +108,9 @@ public partial class Application
|
||||
[InverseProperty("ApplicationBotUser")]
|
||||
public virtual User? BotUser { get; set; }
|
||||
|
||||
[InverseProperty("Application")]
|
||||
public virtual ICollection<Emoji> Emojis { get; set; } = new List<Emoji>();
|
||||
|
||||
[ForeignKey("GuildId")]
|
||||
[InverseProperty("Applications")]
|
||||
public virtual Guild? Guild { get; set; }
|
||||
|
||||
@@ -20,7 +20,7 @@ public partial class Emoji
|
||||
public bool Available { get; set; }
|
||||
|
||||
[Column("guild_id")]
|
||||
public long GuildId { get; set; }
|
||||
public long? GuildId { get; set; }
|
||||
|
||||
[Column("user_id")]
|
||||
public long? UserId { get; set; }
|
||||
@@ -40,9 +40,16 @@ public partial class Emoji
|
||||
[Column("groups")]
|
||||
public List<long>? Groups { get; set; }
|
||||
|
||||
[Column("application_id")]
|
||||
public long? ApplicationId { get; set; }
|
||||
|
||||
[ForeignKey("ApplicationId")]
|
||||
[InverseProperty("Emojis")]
|
||||
public virtual Application? Application { get; set; }
|
||||
|
||||
[ForeignKey("GuildId")]
|
||||
[InverseProperty("Emojis")]
|
||||
public virtual Guild Guild { get; set; } = null!;
|
||||
public virtual Guild? Guild { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
[InverseProperty("Emojis")]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
|
||||
@@ -36,6 +36,8 @@ dotnet-ef dbcontext scaffold "Host=127.0.0.1; Username=postgres; Database=sb-ser
|
||||
--data-annotations \
|
||||
--no-build
|
||||
|
||||
echo 'Cleaning up dependencies...'
|
||||
dotnet remove package Microsoft.EntityFrameworkCore.Design
|
||||
|
||||
echo 'Patching results...'
|
||||
|
||||
@@ -47,6 +49,9 @@ for patch in ../db-patches/*.patch; do
|
||||
patch --verbose -p2 < $patch
|
||||
done
|
||||
|
||||
echo 'Cleaning up temporary files...'
|
||||
rm -v Models/*.cs.orig
|
||||
|
||||
echo '[]' > deps.json
|
||||
git add .
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user