Skip to content

Migrations: Ensure umbracoPropertyData column casing#21015

Merged
kjac merged 3 commits intomainfrom
v17/bugfix/ensure-casing-of-migrated-property-data-column
Dec 1, 2025
Merged

Migrations: Ensure umbracoPropertyData column casing#21015
kjac merged 3 commits intomainfrom
v17/bugfix/ensure-casing-of-migrated-property-data-column

Conversation

@AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Dec 1, 2025

Description

Addresses #20957 and #21010.

This PR adds a migration EnsureUmbracoPropertyDataColumnCasing to fix a column casing issue found on upgraded databases.

SQL Server bulk insert operations are case-sensitive for column names. Earlier versions of Umbraco used lowercase (propertytypeid) whereas newer versions use camel case (propertyTypeId), causing publish failures on upgraded databases where bulk insert operations are used.

Testing

Using SQL Server, ensure the umbracoPropertyData.propertyTypeId column is all lower-case via:

EXEC sp_rename 'dbo.umbracoPropertyData.propertyTypeid', 'propertytypeid', 'COLUMN';

Start Umbraco with the code from this PR and verify that the migration runs and the column is renamed to the camel-cased propertyTypeId.

Copilot AI review requested due to automatic review settings December 1, 2025 10:53
@AndyButland AndyButland changed the title Fix umbracoPropertyData column casing for SQL Server bulk insert Migrations: Ensure umbracoPropertyData column casing Dec 1, 2025
Copy link
Contributor

Copilot AI left a comment

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 adds a migration to fix column name casing issues in the umbracoPropertyData table that affect SQL Server bulk insert operations during publishing. When SQL Server uses SqlBulkCopy for bulk inserts, it performs case-sensitive column name matching. Earlier versions of Umbraco created the propertyTypeId column as propertytypeid (lowercase), while the DTO expects propertyTypeId (camel case), causing publish failures on upgraded databases.

Key Changes:

  • Added migration EnsureUmbracoPropertyDataColumnCasing to rename propertytypeid to propertyTypeId on SQL Server
  • Registered the migration in the UmbracoPlan for version 17.1.0
  • Migration skips SQLite databases where case sensitivity is not an issue

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Umbraco.Infrastructure/Migrations/Upgrade/V_17_1_0/EnsureUmbracoPropertyDataColumnCasing.cs New migration that renames the propertyTypeId column to use correct camel casing on SQL Server databases
src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs Registers the new migration in the upgrade plan for version 17.1.0

AndyButland and others added 2 commits December 1, 2025 12:23
- Add ILogger to log when column is renamed
- Check if column exists with incorrect casing before renaming
- Use fluent Rename API instead of raw SQL
- Add XML remarks documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@kjac kjac left a comment

Choose a reason for hiding this comment

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

I took the liberty to update the migration a bit for clarity 👍

@kjac kjac enabled auto-merge (squash) December 1, 2025 16:31
@kjac kjac merged commit 34aabb8 into main Dec 1, 2025
26 checks passed
@kjac kjac deleted the v17/bugfix/ensure-casing-of-migrated-property-data-column branch December 1, 2025 17:47
AndyButland added a commit that referenced this pull request Dec 1, 2025
* Add migration to fix umbracoPropertyData column casing.

* Improve migration with column existence check and logging

- Add ILogger to log when column is renamed
- Check if column exists with incorrect casing before renaming
- Use fluent Rename API instead of raw SQL
- Add XML remarks documentation

?? Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clarify what old and new column name really is

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: kjac <kja@umbraco.dk>
# Conflicts:
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants