Skip to content

Commit 65305af

Browse files
fix: duplicate insertion issue
Trying to fix the duplicate insertion issue. I'm guessing that EF Core is trying to determine the value before insertion rather than letting the database do it at insertion time. Trying this method to see if it fixes the issue #70
1 parent af876e2 commit 65305af

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Nullinside.Api.Model/Ddl/TwitchBan.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Microsoft.EntityFrameworkCore;
22

3+
using MySql.EntityFrameworkCore.Extensions;
4+
35
namespace Nullinside.Api.Model.Ddl;
46

57
/// <summary>
@@ -39,6 +41,8 @@ public class TwitchBan : ITableModel {
3941
public void OnModelCreating(ModelBuilder modelBuilder) {
4042
modelBuilder.Entity<TwitchBan>(entity => {
4143
entity.HasKey(e => e.Id);
44+
entity.Property(e => e.Id)
45+
.UseMySQLAutoIncrementColumn("int");
4246
entity.Property(e => e.ChannelId)
4347
.HasMaxLength(255);
4448
entity.Property(e => e.BannedUserTwitchId)

src/Nullinside.Api.Model/Migrations/NullinsideContextModelSnapshot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1616
{
1717
#pragma warning disable 612, 618
1818
modelBuilder
19-
.HasAnnotation("ProductVersion", "8.0.11")
19+
.HasAnnotation("ProductVersion", "8.0.13")
2020
.HasAnnotation("Relational:MaxIdentifierLength", 64);
2121

2222
modelBuilder.Entity("Nullinside.Api.Model.Ddl.DockerDeployments", b =>

0 commit comments

Comments
 (0)