V10: Migrate member properties to columns on the member table (#12205)

* Add new columns to the member table

* Add missing IsApproved column

* Add joins with nested query

* Add query for selecting new column values from existing members

* Update the member data from the same query

* Make escapes work for sqlite

* Use GetFieldNameForUpdate instead of GetFieldName

* Left join on memberDto

* Remove the now unused property types and data

* Don't create member columns as properties anymore

* Store old properties in fields on member

Also switch the dates to nullable since they can be null

* Map columns when mapping from DTO to Member object

* Display columns in the member content app

* Fix null exception when creating new user

* Hide value if user doesn't have access to sensitive data

* Remove hardcoded member properties

* Obsolete old member alias constants

* Map and persist member properties

* Correctly update LastLogin when member logs in

* Map IsApproved and IsLockedOut when saving member in backoffice

* Update the query mappers for members

* Fix member service tracks dirty changes test

* Remove no longer existing property types from member type builder

* Fix null error in UpdateMemberProperties

* Fix builder tests

* Fix SetupMemberTestData in MemberControllerUnitTests

* Let LastLoginDate be null and handle check in controller

There's no reason to default a perfectly nullable property to default(DateTime)

* Add translation key for is approved and use that instead of constant

* Obsolete old label constants

* Fix whitespace post merge

* Fix up test comments

* Apply suggestions from code review

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>

* Fix member properties always being sensitive

Co-authored-by: Elitsa Marinovska <elm@umbraco.dk>
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
This commit is contained in:
Mole
2022-04-21 14:47:27 +02:00
committed by GitHub
parent 6d0a0fff9c
commit 7df4f84247
36 changed files with 744 additions and 489 deletions

View File

@@ -405,6 +405,24 @@ namespace Umbraco.Extensions
return sql.InnerJoin(join);
}
/// <summary>
/// Appends an INNER JOIN clause using a nested query.
/// </summary>
/// <param name="sql">The SQL statement.</param>
/// <param name="nestedSelect">The nested sql query.</param>
/// <param name="alias">An optional alias for the joined table.</param>
/// <returns>A SqlJoin statement.</returns>
public static Sql<ISqlContext>.SqlJoinClause<ISqlContext> InnerJoin(this Sql<ISqlContext> sql, Sql<ISqlContext> nestedSelect, string alias = null)
{
var join = $"({nestedSelect.SQL})";
if (alias is not null)
{
join += " " + sql.SqlContext.SqlSyntax.GetQuotedTableName(alias);
}
return sql.InnerJoin(join);
}
/// <summary>
/// Appends a LEFT JOIN clause to the Sql statement.
/// </summary>
@@ -437,6 +455,24 @@ namespace Umbraco.Extensions
string alias = null) =>
sql.SqlContext.SqlSyntax.LeftJoinWithNestedJoin<TDto>(sql, nestedJoin, alias);
/// <summary>
/// Appends an LEFT JOIN clause using a nested query.
/// </summary>
/// <param name="sql">The SQL statement.</param>
/// <param name="nestedSelect">The nested sql query.</param>
/// <param name="alias">An optional alias for the joined table.</param>
/// <returns>A SqlJoin statement.</returns>
public static Sql<ISqlContext>.SqlJoinClause<ISqlContext> LeftJoin(this Sql<ISqlContext> sql, Sql<ISqlContext> nestedSelect, string alias = null)
{
var join = $"({nestedSelect.SQL})";
if (alias is not null)
{
join += " " + sql.SqlContext.SqlSyntax.GetQuotedTableName(alias);
}
return sql.LeftJoin(join);
}
/// <summary>
/// Appends a RIGHT JOIN clause to the Sql statement.
/// </summary>