chore(core): Change db column type to TEXT for subject_id #25044
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses a database limitation where the
subject_idcolumn in thedynamic_credential_entrytable was restricted tovarchar(16), which is insufficient for certain dynamic credential resolvers that generate longer subject identifiers.Changes Made
ExpandSubjectIDColumnLength1769690595000migration that:subject_idcolumn type fromvarchar(16)toTEXT(unbounded)subject_idis part of the composite primary key)copyTableutility (batch copying in chunks of 10 rows)Why Table Recreation?
The
subject_idcolumn is part of a composite primary key (credential_id,subject_id,resolver_id). Both PostgreSQL and SQLite have restrictions on altering columns that are part of primary key constraints:The cleanest and safest approach is to recreate the table with the new schema, which the migration does using n8n's built-in
copyTableutility that handles data preservation, foreign keys, and indexes.Related Linear tickets, Github issues, and Community forum posts
closes https://linear.app/n8n/issue/IAM-204/increase-varchar-limit-for-subjectid-column-in-postgrest-for-dynamic
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)