fix-more-sql-syntax-issues (closes #20453)#21326
fix-more-sql-syntax-issues (closes #20453)#21326idseefeld wants to merge 260 commits intoumbraco:mainfrom
Conversation
|
Hi there @idseefeld, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There was a problem hiding this comment.
Pull request overview
This PR fixes SQL syntax issues to support PostgreSQL provider compatibility. The changes standardize column name casing to lowercase, replace ExecuteScalar with FirstOrDefault for better database compatibility, add PostgreSQL sequence support, and refactor database insertion methods to use a centralized approach with DTO-based table/column name constants.
Key changes:
- Standardized column naming to use lowercase and constants from DTOs
- Added sequence support infrastructure for PostgreSQL compatibility
- Refactored database insertion to use a centralized
Insert<T>method - Changed
ExecuteScalarcalls toFirstOrDefaultfor consistency
Reviewed changes
Copilot reviewed 110 out of 110 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ContentTypeRepositorySqlClausesTest.cs | Fixed column name casing in test assertions (Id → id, UniqueId → uniqueId) |
| NPocoSqlExtensionsTests.cs | Updated test to expect LOWER() wrapper for case-insensitive string comparisons |
| DictionaryTranslationMapperTest.cs | Fixed expected column name casing (UniqueId → uniqueId) |
| DatabaseCacheRepository.cs | Refactored update logic from InsertOrUpdate to explicit Insert/Update with typed queries |
| UserIdKeyResolver.cs | Changed ExecuteScalar to FirstOrDefault for consistency |
| UmbracoDatabaseFactory.cs | Changed visibility to protected for extensibility |
| UmbracoDatabaseExtensions.cs | Changed ExecuteScalar to FirstOrDefault |
| SqlSyntaxProviderBase.cs & ISqlSyntaxProvider.cs | Added GetNullExtension, SupportsSequences, and AlterSequences methods for PostgreSQL |
| Multiple Repository files | Standardized to use QuoteColumnName helpers and typed SQL builders |
| All DTO files | Added PrimaryKeyName constants and updated Column attributes to use constants |
| DatabaseDataCreator.cs | Major refactoring: centralized Insert method, removed table/column name strings |
| DatabaseSchemaCreator.cs | Added sequence support after identity insert operations |
| DatabaseSchemaInitializedNotification.cs | New notification class for database schema initialization |
| Constants-DatabaseSchema.cs | Added common primary key and column name constants |
| Multiple API Controller files | Changed from nameof() to using NodeDto column name constants |
…-more-sql-syntax-issues
…-more-sql-syntax-issues
…ContentTypeDto.cs Co-authored-by: Andy Butland <abutland73@gmail.com>
…1451-raw-sql-issues
…21451-21513-more-NPocoSqlExtensions
…ons' into v173/20453-21446-21448-21451-21513-21516-DatabaseDataCreator-refactor
…eator-refactor' into v173/20453-fix-more-sql-syntax-issues
…Scalar<long>(query). It is fine for PostgreSql too.
…github.com/idseefeld/Umbraco-CMS into v173/21448-FirstOrDefault-vs-ExecuteScalar
…1451-raw-sql-issues
…21451-21513-more-NPocoSqlExtensions
…ons' into v173/20453-21446-21448-21451-21513-21516-DatabaseDataCreator-refactor
…eator-refactor' into v173/20453-fix-more-sql-syntax-issues
…ethods' into v173/20453-21446-21448-21451-21513-more-NPocoSqlExtensions
…ons' into v173/20453-21446-21448-21451-21513-21516-DatabaseDataCreator-refactor
…eator-refactor' into v173/20453-fix-more-sql-syntax-issues
refactor new extensions into another file
…ethods' into v173/20453-21446-21448-21451-21513-more-NPocoSqlExtensions
…ons' into v173/20453-21446-21448-21451-21513-21516-DatabaseDataCreator-refactor
…eator-refactor' into v173/20453-fix-more-sql-syntax-issues
…ethods' into v173/20453-21446-21448-21451-21513-more-NPocoSqlExtensions
…ons' into v173/20453-21446-21448-21451-21513-21516-DatabaseDataCreator-refactor
…eator-refactor' into v173/20453-fix-more-sql-syntax-issues
Prerequisites
All unit & integration test for SQLite & SQL Server should run successfully.
Changes are meaningful for my PostgreSQL provider: https://github.com/idseefeld/Umbraco-CMS/tree/v173/postgreSqlProvider