Fixes many hard coded SQL table names with the proposed new prefix
This commit is contained in:
@@ -502,13 +502,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
{
|
||||
case "VERSIONDATE":
|
||||
case "UPDATEDATE":
|
||||
return GetDatabaseFieldNameForOrderBy("uContentVersion", "versionDate");
|
||||
return GetDatabaseFieldNameForOrderBy(Constants.DatabaseSchema.Tables.ContentVersion, "versionDate");
|
||||
case "CREATEDATE":
|
||||
return GetDatabaseFieldNameForOrderBy("umbracoNode", "createDate");
|
||||
case "NAME":
|
||||
return GetDatabaseFieldNameForOrderBy("umbracoNode", "text");
|
||||
case "PUBLISHED":
|
||||
return GetDatabaseFieldNameForOrderBy("uDocument", "published");
|
||||
return GetDatabaseFieldNameForOrderBy(Constants.DatabaseSchema.Tables.Document, "published");
|
||||
case "OWNER":
|
||||
//TODO: This isn't going to work very nicely because it's going to order by ID, not by letter
|
||||
return GetDatabaseFieldNameForOrderBy("umbracoNode", "nodeUser");
|
||||
|
||||
@@ -1091,11 +1091,11 @@ ORDER BY contentTypeId, id";
|
||||
pt.contentTypeId AS contentTypeId,
|
||||
pt.id AS id, pt.uniqueID AS " + sqlSyntax.GetQuotedColumnName("key") + @",
|
||||
pt.propertyTypeGroupId AS groupId,
|
||||
pt.Alias AS alias, pt." + sqlSyntax.GetQuotedColumnName("Description") + @" AS " + sqlSyntax.GetQuotedColumnName("desc") + @", pt.mandatory AS mandatory,
|
||||
pt.Alias AS alias, pt." + sqlSyntax.GetQuotedColumnName("Description") + @" AS " + sqlSyntax.GetQuotedColumnName("desc") + $@", pt.mandatory AS mandatory,
|
||||
pt.Name AS name, pt.sortOrder AS sortOrder, pt.validationRegExp AS regexp, pt.variations as variations,
|
||||
dt.nodeId as dataTypeId, dt.dbType as dbType, dt.propertyEditorAlias as editorAlias
|
||||
FROM cmsPropertyType pt
|
||||
INNER JOIN uDataType as dt ON pt.dataTypeId = dt.nodeId
|
||||
INNER JOIN {Constants.DatabaseSchema.Tables.DataType} as dt ON pt.dataTypeId = dt.nodeId
|
||||
WHERE pt.contentTypeId IN (@ids)
|
||||
ORDER BY contentTypeId, groupId, id";
|
||||
|
||||
@@ -1238,9 +1238,9 @@ WHERE cmsContentType." + aliasColumn + @" LIKE @pattern",
|
||||
public bool HasContainerInPath(string contentPath)
|
||||
{
|
||||
var ids = contentPath.Split(',').Select(int.Parse);
|
||||
var sql = new Sql(@"SELECT COUNT(*) FROM cmsContentType
|
||||
INNER JOIN uContent ON cmsContentType.nodeId=uContent.contentTypeId
|
||||
WHERE uContent.nodeId IN (@ids) AND cmsContentType.isContainer=@isContainer", new { ids, isContainer = true });
|
||||
var sql = new Sql($@"SELECT COUNT(*) FROM cmsContentType
|
||||
INNER JOIN {Constants.DatabaseSchema.Tables.Content} ON cmsContentType.nodeId={Constants.DatabaseSchema.Tables.Content}.contentTypeId
|
||||
WHERE {Constants.DatabaseSchema.Tables.Content}.nodeId IN (@ids) AND cmsContentType.isContainer=@isContainer", new { ids, isContainer = true });
|
||||
return Database.ExecuteScalar<int>(sql) > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,12 +355,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
entity.ResetDirtyProperties();
|
||||
|
||||
// troubleshooting
|
||||
//if (Database.ExecuteScalar<int>("SELECT COUNT(*) FROM uDocumentVersion JOIN uContentVersion ON uDocumentVersion.id=uContentVersion.id WHERE published=1 AND nodeId=" + content.Id) > 1)
|
||||
//if (Database.ExecuteScalar<int>($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE published=1 AND nodeId=" + content.Id) > 1)
|
||||
//{
|
||||
// Debugger.Break();
|
||||
// throw new Exception("oops");
|
||||
//}
|
||||
//if (Database.ExecuteScalar<int>("SELECT COUNT(*) FROM uDocumentVersion JOIN uContentVersion ON uDocumentVersion.id=uContentVersion.id WHERE [current]=1 AND nodeId=" + content.Id) > 1)
|
||||
//if (Database.ExecuteScalar<int>($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE [current]=1 AND nodeId=" + content.Id) > 1)
|
||||
//{
|
||||
// Debugger.Break();
|
||||
// throw new Exception("oops");
|
||||
@@ -500,12 +500,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
entity.ResetDirtyProperties();
|
||||
|
||||
// troubleshooting
|
||||
//if (Database.ExecuteScalar<int>("SELECT COUNT(*) FROM uDocumentVersion JOIN uContentVersion ON uDocumentVersion.id=uContentVersion.id WHERE published=1 AND nodeId=" + content.Id) > 1)
|
||||
//if (Database.ExecuteScalar<int>($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE published=1 AND nodeId=" + content.Id) > 1)
|
||||
//{
|
||||
// Debugger.Break();
|
||||
// throw new Exception("oops");
|
||||
//}
|
||||
//if (Database.ExecuteScalar<int>("SELECT COUNT(*) FROM uDocumentVersion JOIN uContentVersion ON uDocumentVersion.id=uContentVersion.id WHERE [current]=1 AND nodeId=" + content.Id) > 1)
|
||||
//if (Database.ExecuteScalar<int>($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE [current]=1 AND nodeId=" + content.Id) > 1)
|
||||
//{
|
||||
// Debugger.Break();
|
||||
// throw new Exception("oops");
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
|
||||
if (entity.RootContentId.HasValue)
|
||||
{
|
||||
var contentExists = Database.ExecuteScalar<int>("SELECT COUNT(*) FROM uContent WHERE nodeId = @id", new { id = entity.RootContentId.Value });
|
||||
var contentExists = Database.ExecuteScalar<int>($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.Content} WHERE nodeId = @id", new { id = entity.RootContentId.Value });
|
||||
if (contentExists == 0) throw new NullReferenceException("No content exists with id " + entity.RootContentId.Value);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
|
||||
if (entity.RootContentId.HasValue)
|
||||
{
|
||||
var contentExists = Database.ExecuteScalar<int>("SELECT COUNT(*) FROM uContent WHERE nodeId = @id", new { id = entity.RootContentId.Value });
|
||||
var contentExists = Database.ExecuteScalar<int>($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.Content} WHERE nodeId = @id", new { id = entity.RootContentId.Value });
|
||||
if (contentExists == 0) throw new NullReferenceException("No content exists with id " + entity.RootContentId.Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
"cmsPropertyType.Name", "cmsPropertyType.Description", "cmsPropertyType.mandatory", "cmsPropertyType.UniqueID",
|
||||
"cmsPropertyType.validationRegExp", "cmsPropertyType.dataTypeId", "cmsPropertyType.sortOrder AS PropertyTypeSortOrder",
|
||||
"cmsPropertyType.propertyTypeGroupId AS PropertyTypesGroupId", "cmsMemberType.memberCanEdit", "cmsMemberType.viewOnProfile",
|
||||
"uDataType.propertyEditorAlias", "uDataType.dbType", "cmsPropertyTypeGroup.id AS PropertyTypeGroupId",
|
||||
$"{Constants.DatabaseSchema.Tables.DataType}.propertyEditorAlias", $"{Constants.DatabaseSchema.Tables.DataType}.dbType", "cmsPropertyTypeGroup.id AS PropertyTypeGroupId",
|
||||
"cmsPropertyTypeGroup.text AS PropertyGroupName", "cmsPropertyTypeGroup.uniqueID AS PropertyGroupUniqueID",
|
||||
"cmsPropertyTypeGroup.sortorder AS PropertyGroupSortOrder", "cmsPropertyTypeGroup.contenttypeNodeId")
|
||||
.From<NodeDto>()
|
||||
|
||||
Reference in New Issue
Block a user