From 65305af26d08f915a93adba62831f5a55d83c3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= Date: Wed, 5 Mar 2025 15:06:35 -0500 Subject: [PATCH] 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 nullinside-development-group/nullinside-api#70 --- src/Nullinside.Api.Model/Ddl/TwitchBan.cs | 4 ++++ .../Migrations/NullinsideContextModelSnapshot.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Nullinside.Api.Model/Ddl/TwitchBan.cs b/src/Nullinside.Api.Model/Ddl/TwitchBan.cs index 7ad5cea..5ccfcf9 100644 --- a/src/Nullinside.Api.Model/Ddl/TwitchBan.cs +++ b/src/Nullinside.Api.Model/Ddl/TwitchBan.cs @@ -1,5 +1,7 @@ using Microsoft.EntityFrameworkCore; +using MySql.EntityFrameworkCore.Extensions; + namespace Nullinside.Api.Model.Ddl; /// @@ -39,6 +41,8 @@ public class TwitchBan : ITableModel { public void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.Id); + entity.Property(e => e.Id) + .UseMySQLAutoIncrementColumn("int"); entity.Property(e => e.ChannelId) .HasMaxLength(255); entity.Property(e => e.BannedUserTwitchId) diff --git a/src/Nullinside.Api.Model/Migrations/NullinsideContextModelSnapshot.cs b/src/Nullinside.Api.Model/Migrations/NullinsideContextModelSnapshot.cs index 040f4d1..129f2f5 100644 --- a/src/Nullinside.Api.Model/Migrations/NullinsideContextModelSnapshot.cs +++ b/src/Nullinside.Api.Model/Migrations/NullinsideContextModelSnapshot.cs @@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") + .HasAnnotation("ProductVersion", "8.0.13") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("Nullinside.Api.Model.Ddl.DockerDeployments", b =>