Skip to content

Fix MySQL index key too long for ResourcePermissionGrant#25495

Merged
EngincanV merged 1 commit into
devfrom
fix/mysql-resource-permission-grant-index
Jun 1, 2026
Merged

Fix MySQL index key too long for ResourcePermissionGrant#25495
EngincanV merged 1 commit into
devfrom
fix/mysql-resource-permission-grant-index

Conversation

@maliming

Copy link
Copy Markdown
Member

Creating a new MySQL app fails on the initial EF Core migration with "Specified key was too long; max key length is 3072 bytes". The ResourcePermissionGrant 6-column unique index reaches 3108 bytes under utf8mb4. Shorten ResourceName/ResourceKey to 128 on MySQL only so the index fits the 3072 limit; other databases keep 256.

Resolves #25492

Shorten ResourceName/ResourceKey to 128 on MySQL so the composite unique index fits the InnoDB 3072 bytes limit under utf8mb4.
Copilot AI review requested due to automatic review settings May 29, 2026 04:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses MySQL initial migration failures for ResourcePermissionGrant by reducing indexed resource column lengths only when the EF Core model is configured for MySQL.

Changes:

  • Adds MySQL-specific max-length values for ResourceName and ResourceKey.
  • Keeps existing default lengths for non-MySQL providers.
  • Targets the composite unique index that exceeds MySQL’s utf8mb4 index key limit.

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.42%. Comparing base (c7b7b87) to head (31c1b17).

Files with missing lines Patch % Lines
...issionManagementDbContextModelBuilderExtensions.cs 71.42% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #25495      +/-   ##
==========================================
+ Coverage   49.40%   49.42%   +0.01%     
==========================================
  Files        3670     3670              
  Lines      123599   123604       +5     
  Branches     9453     9455       +2     
==========================================
+ Hits        61068    61090      +22     
+ Misses      60711    60689      -22     
- Partials     1820     1825       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EngincanV EngincanV merged commit 002e9b4 into dev Jun 1, 2026
5 checks passed
@EngincanV EngincanV deleted the fix/mysql-resource-permission-grant-index branch June 1, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL: Specified key was too long on AbpResourcePermissionGrants unique index (max key length is 3072 bytes)

3 participants