Skip to content

Commit

Permalink
Make it work on MySQL Again
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Nov 10, 2024
1 parent d72002e commit 298d2f9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
</ItemGroup>
<ItemGroup Label="Infrastructure">
<PackageVersion Include="Azure.Storage.Blobs" Version="12.22.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0-rc.2.24474.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0-rc.2.24474.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-rc.2.24474.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="9.0.0-rc.2.24474.3" />
<PackageVersion Include="MongoDB.Driver" Version="2.30.0" />
<PackageVersion Include="MySql.EntityFrameworkCore" Version="9.0.0-preview" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageVersion Include="RavenDB.Client" Version="6.2.1" />
</ItemGroup>
<ItemGroup Label="Web">
Expand All @@ -38,7 +38,7 @@
<PackageVersion Include="bunit.generators" Version="2.0.24-preview" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="xunit.v3" Version="0.5.0-pre.27" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0-pre.42" />
<PackageVersion Include="xunit.v3" Version="0.6.0-pre.7" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0-pre.49" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" />
<PackageReference Include="MongoDB.Driver" />
<PackageReference Include="MySql.EntityFrameworkCore" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" />
<PackageReference Include="RavenDB.Client" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ArgumentNullException.ThrowIfNull(modelBuilder);

modelBuilder.ApplyConfiguration(new BlogPostConfiguration(Database));
modelBuilder.ApplyConfiguration(new BlogPostConfiguration());
modelBuilder.ApplyConfiguration(new BlogPostRecordConfiguration());
modelBuilder.ApplyConfiguration(new ProfileInformationEntryConfiguration());
modelBuilder.ApplyConfiguration(new ShortCodeConfiguration());
modelBuilder.ApplyConfiguration(new SimilarBlogPostConfiguration(Database));
modelBuilder.ApplyConfiguration(new SimilarBlogPostConfiguration());
modelBuilder.ApplyConfiguration(new SkillConfiguration());
modelBuilder.ApplyConfiguration(new TalkConfiguration());
modelBuilder.ApplyConfiguration(new UserRecordConfiguration());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public void Configure(EntityTypeBuilder<BlogPost> builder)
builder.Property(x => x.ShortDescription).IsRequired();
builder.Property(x => x.Likes).IsRequired();
builder.Property(x => x.IsPublished).IsRequired();
builder.Property(x => x.Tags).HasMaxLength(2096);

builder.Property(x => x.Tags).HasMaxLength(2048);

builder.HasIndex(x => new { x.IsPublished, x.UpdatedDate })
.HasDatabaseName("IX_BlogPosts_IsPublished_UpdatedDate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public void Configure(EntityTypeBuilder<SimilarBlogPost> builder)
builder.Property(b => b.Id)
.IsUnicode(false)
.ValueGeneratedOnAdd();
builder.Property(b => b.SimilarBlogPostIds).HasMaxLength(450 * 3).IsRequired();

builder
.Property(b => b.SimilarBlogPostIds)
.HasMaxLength(450 * 3)
.IsRequired();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public static void UseMySqlAsStorageProvider(this IServiceCollection services)
{
var configuration = s.GetRequiredService<IOptions<ApplicationConfiguration>>();
var connectionString = configuration.Value.ConnectionString;
builder.UseMySQL(connectionString)
builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), mySqlOptions =>
{
mySqlOptions.EnablePrimitiveCollectionsSupport();
})
#if DEBUG
.EnableDetailedErrors()
#endif
Expand Down

0 comments on commit 298d2f9

Please sign in to comment.