Split dbo schema into per-domain SQL schemas (#274)

This commit is contained in:
Aaron Po
2026-09-02 22:23:30 -04:00
committed by GitHub
parent 8d59f09cb2
commit d6e176bcd9
37 changed files with 275 additions and 227 deletions

View File

@@ -62,11 +62,11 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
co.CountryID,
co.CountryName,
co.ISO3166_1 AS Iso31661
FROM dbo.BreweryPost bp
LEFT JOIN dbo.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN dbo.City c ON bpl.CityID = c.CityID
LEFT JOIN dbo.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN dbo.Country co ON sp.CountryID = co.CountryID
FROM Brewery.BreweryPost bp
LEFT JOIN Brewery.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN Geolocation.City c ON bpl.CityID = c.CityID
LEFT JOIN Geolocation.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN Geolocation.Country co ON sp.CountryID = co.CountryID
WHERE bp.BreweryPostID = @BreweryPostId
""",
new { BreweryPostId = id },
@@ -85,7 +85,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
await using DbConnection connection = await CreateConnection();
return await connection.ExecuteScalarAsync<Guid?>(
new CommandDefinition(
"SELECT PostedByID FROM dbo.BreweryPost WHERE BreweryPostID = @BreweryPostId",
"SELECT PostedByID FROM Brewery.BreweryPost WHERE BreweryPostID = @BreweryPostId",
new { BreweryPostId = id },
cancellationToken: cancellationToken
)
@@ -126,11 +126,11 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
co.CountryID,
co.CountryName,
co.ISO3166_1 AS Iso31661
FROM dbo.BreweryPost bp
LEFT JOIN dbo.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN dbo.City c ON bpl.CityID = c.CityID
LEFT JOIN dbo.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN dbo.Country co ON sp.CountryID = co.CountryID
FROM Brewery.BreweryPost bp
LEFT JOIN Brewery.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN Geolocation.City c ON bpl.CityID = c.CityID
LEFT JOIN Geolocation.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN Geolocation.Country co ON sp.CountryID = co.CountryID
ORDER BY bp.CreatedAt DESC
OFFSET @Offset ROWS FETCH NEXT @Limit ROWS ONLY
""",
@@ -173,11 +173,11 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
co.CountryName,
co.ISO3166_1 AS Iso31661,
bpl.Coordinates.STDistance(@Origin) AS DistanceMetres
FROM dbo.BreweryPost bp
INNER JOIN dbo.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN dbo.City c ON bpl.CityID = c.CityID
LEFT JOIN dbo.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN dbo.Country co ON sp.CountryID = co.CountryID
FROM Brewery.BreweryPost bp
INNER JOIN Brewery.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN Geolocation.City c ON bpl.CityID = c.CityID
LEFT JOIN Geolocation.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN Geolocation.Country co ON sp.CountryID = co.CountryID
WHERE bpl.Coordinates IS NOT NULL
AND bpl.Coordinates.STDistance(@Origin) <= @RangeInMetres
ORDER BY bpl.Coordinates.STDistance(@Origin) ASC
@@ -223,11 +223,11 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
co.CountryID,
co.CountryName,
co.ISO3166_1 AS Iso31661
FROM dbo.BreweryPost bp
INNER JOIN dbo.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN dbo.City c ON bpl.CityID = c.CityID
LEFT JOIN dbo.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN dbo.Country co ON sp.CountryID = co.CountryID
FROM Brewery.BreweryPost bp
INNER JOIN Brewery.BreweryPostLocation bpl ON bp.BreweryPostID = bpl.BreweryPostID
LEFT JOIN Geolocation.City c ON bpl.CityID = c.CityID
LEFT JOIN Geolocation.StateProvince sp ON c.StateProvinceID = sp.StateProvinceID
LEFT JOIN Geolocation.Country co ON sp.CountryID = co.CountryID
WHERE bpl.Coordinates IS NOT NULL
ORDER BY bp.BreweryPostID ASC
""",
@@ -249,7 +249,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
SELECT 1 FROM
dbo.BreweryPost
Brewery.BreweryPost
WHERE
BreweryPostID = @BreweryPostId
""",
@@ -268,7 +268,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
bool cityExists =
await connection.ExecuteScalarAsync<int?>(
new CommandDefinition(
"SELECT 1 FROM dbo.City WHERE CityID = @CityId",
"SELECT 1 FROM Geolocation.City WHERE CityID = @CityId",
new { brewery.Location.CityId },
transaction,
cancellationToken: cancellationToken
@@ -283,7 +283,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
int updatedRows = await connection.ExecuteAsync(
new CommandDefinition(
"""
UPDATE dbo.BreweryPost
UPDATE Brewery.BreweryPost
SET BreweryName = @BreweryName,
Description = @Description,
UpdatedAt = GETDATE()
@@ -315,7 +315,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
DELETE FROM
dbo.BreweryPostLocation
Brewery.BreweryPostLocation
WHERE BreweryPostID = @BreweryPostId
""",
new { brewery.BreweryPostId },
@@ -331,7 +331,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
SELECT 1
FROM dbo.BreweryPostLocation
FROM Brewery.BreweryPostLocation
WHERE BreweryPostID = @BreweryPostId
""",
new { brewery.BreweryPostId },
@@ -345,7 +345,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
UPDATE dbo.BreweryPostLocation
UPDATE Brewery.BreweryPostLocation
SET CityID = @CityId,
AddressLine1 = @AddressLine1,
AddressLine2 = @AddressLine2,
@@ -375,7 +375,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.BreweryPostLocation
INSERT INTO Brewery.BreweryPostLocation
(BreweryPostLocationID,
BreweryPostID,
CityID,
@@ -434,7 +434,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
int rows = await connection.ExecuteAsync(
"""
DELETE FROM
dbo.BreweryPost
Brewery.BreweryPost
WHERE
BreweryPostID = @BreweryPostId
""",
@@ -462,7 +462,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
"""
SELECT 1
FROM
dbo.UserAccount
Auth.UserAccount
WHERE
UserAccountID = @PostedById
""",
@@ -481,7 +481,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
"""
SELECT 1
FROM
dbo.City
Geolocation.City
WHERE
CityID = @CityId
""",
@@ -497,7 +497,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.BreweryPost
INSERT INTO Brewery.BreweryPost
(BreweryPostID, BreweryName, Description, PostedByID)
VALUES
(@BreweryPostId, @BreweryName, @Description, @PostedById)
@@ -516,7 +516,7 @@ public class BreweryRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.BreweryPostLocation
INSERT INTO Brewery.BreweryPostLocation
(BreweryPostLocationID,
BreweryPostID,
CityID,

View File

@@ -46,7 +46,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteScalarAsync<int?>(
"""
SELECT 1
FROM dbo.City
FROM Geolocation.City
WHERE CityName = @CityName AND StateProvinceID = @StateProvinceId
""",
new { location.CityName, StateProvinceId = stateProvinceId }
@@ -56,7 +56,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
if (!cityExists)
await connection.ExecuteAsync(
"""
INSERT INTO dbo.City (StateProvinceID, CityName)
INSERT INTO Geolocation.City (StateProvinceID, CityName)
VALUES (@StateProvinceId, @CityName)
""",
new { StateProvinceId = stateProvinceId, location.CityName }
@@ -79,7 +79,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteScalarAsync<int?>(
"""
SELECT 1
FROM dbo.Country
FROM Geolocation.Country
WHERE ISO3166_1 = @ISO3166_1
""",
new { ISO3166_1 = isoCode }
@@ -91,7 +91,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
// race is tolerated (the resulting duplicate row, if any, is out of scope for this method).
await connection.ExecuteAsync(
"""
INSERT INTO dbo.Country (CountryName, ISO3166_1)
INSERT INTO Geolocation.Country (CountryName, ISO3166_1)
VALUES (@CountryName, @ISO3166_1)
""",
new { CountryName = countryName, ISO3166_1 = isoCode }
@@ -125,7 +125,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteScalarAsync<int?>(
"""
SELECT 1
FROM dbo.StateProvince
FROM Geolocation.StateProvince
WHERE ISO3166_2 = @ISO3166_2
""",
new { ISO3166_2 = isoCode }
@@ -135,7 +135,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
if (!exists)
await connection.ExecuteAsync(
"""
INSERT INTO dbo.StateProvince (StateProvinceName, ISO3166_2, CountryID)
INSERT INTO Geolocation.StateProvince (StateProvinceName, ISO3166_2, CountryID)
VALUES (@StateProvinceName, @ISO3166_2, @CountryId)
""",
new
@@ -153,7 +153,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
return await connection.ExecuteScalarAsync<Guid?>(
"""
SELECT CountryID
FROM dbo.Country
FROM Geolocation.Country
WHERE ISO3166_1 = @ISO3166_1
""",
new { ISO3166_1 = isoCode }
@@ -166,7 +166,7 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
return await connection.ExecuteScalarAsync<Guid?>(
"""
SELECT StateProvinceID
FROM dbo.StateProvince
FROM Geolocation.StateProvince
WHERE ISO3166_2 = @ISO3166_2
""",
new { ISO3166_2 = isoCode }
@@ -179,8 +179,8 @@ public class LocationRepository(ISqlConnectionFactory connectionFactory)
return await connection.ExecuteScalarAsync<Guid?>(
"""
SELECT c.CityID
FROM dbo.City c
INNER JOIN dbo.StateProvince sp ON sp.StateProvinceID = c.StateProvinceID
FROM Geolocation.City c
INNER JOIN Geolocation.StateProvince sp ON sp.StateProvinceID = c.StateProvinceID
WHERE c.CityName = @CityName AND sp.ISO3166_2 = @StateProvinceCode
""",
new { CityName = cityName, StateProvinceCode = stateProvinceIsoCode }

View File

@@ -28,7 +28,7 @@ public class PhotoUploadRepository(ISqlConnectionFactory connectionFactory)
"""
SELECT 1
FROM
dbo.UserAccount
Auth.UserAccount
WHERE
UserAccountID = @UploadedById
""",
@@ -44,7 +44,7 @@ public class PhotoUploadRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.Photo (PhotoID, Hyperlink, UploadedByID)
INSERT INTO Media.Photo (PhotoID, Hyperlink, UploadedByID)
VALUES (@PhotoId, @Hyperlink, @UploadedById)
""",
new { photo.PhotoId, photo.Hyperlink, photo.UploadedById },

View File

@@ -8,8 +8,8 @@ namespace Features.Auth.Identity;
/// <summary>
/// Dapper-based implementation of the ASP.NET Core Identity store interfaces consumed by
/// <see cref="UserManager{TUser}" />, persisting against the existing <c>dbo.UserAccount</c>,
/// <c>dbo.UserCredential</c>, and <c>dbo.UserVerification</c> tables. No EF Core is used, and no schema
/// <see cref="UserManager{TUser}" />, persisting against the existing <c>Auth.UserAccount</c>,
/// <c>Auth.UserCredential</c>, and <c>Auth.UserVerification</c> tables. No EF Core is used, and no schema
/// changes were required: normalized name/email are computed on the fly rather than persisted (the
/// existing unique indexes are already case-insensitive under SQL Server's default collation).
/// </summary>
@@ -21,7 +21,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
{
private const string SelectUserSql = """
SELECT UserAccountID AS Id, Username AS UserName, FirstName, LastName, Email, DateOfBirth
FROM dbo.UserAccount
FROM Auth.UserAccount
""";
/// <remarks>No unmanaged resources to release; each method opens and disposes its own connection.</remarks>
@@ -87,7 +87,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
Guid userAccountId = await connection.ExecuteScalarAsync<Guid>(
new CommandDefinition(
"""
INSERT INTO dbo.UserAccount (Username, FirstName, LastName, DateOfBirth, Email)
INSERT INTO Auth.UserAccount (Username, FirstName, LastName, DateOfBirth, Email)
OUTPUT INSERTED.UserAccountID
VALUES (@UserName, @FirstName, @LastName, @DateOfBirth, @Email);
""",
@@ -107,7 +107,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.UserCredential (UserAccountId, Hash)
INSERT INTO Auth.UserCredential (UserAccountId, Hash)
VALUES (@UserAccountId, @Hash);
""",
new { UserAccountId = userAccountId, Hash = user.PasswordHash },
@@ -141,7 +141,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
/// <inheritdoc />
/// <remarks>
/// Persists profile field changes and keeps <c>dbo.UserVerification</c> in sync with
/// Persists profile field changes and keeps <c>Auth.UserVerification</c> in sync with
/// <see cref="ApplicationUser.EmailConfirmed" />: a row is inserted (idempotently, matching the
/// previous <c>AuthRepository.ConfirmUserAccountAsync</c> behavior) when
/// <see langword="true" />, and removed when <see langword="false" /> -- notably after
@@ -157,7 +157,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
UPDATE dbo.UserAccount
UPDATE Auth.UserAccount
SET Username = @UserName, FirstName = @FirstName, LastName = @LastName,
Email = @Email, DateOfBirth = @DateOfBirth, UpdatedAt = GETDATE()
WHERE UserAccountID = @Id
@@ -185,9 +185,9 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
/// <inheritdoc />
/// <remarks>
/// A plain <c>DELETE</c> against <c>dbo.UserAccount</c>: its foreign keys from
/// <c>dbo.UserCredential</c>, <c>dbo.UserVerification</c>, and <c>dbo.UserProfile</c> cascade
/// (<c>dbo.UserAvatar</c> cascades transitively through <c>dbo.UserProfile</c>), so no manual
/// A plain <c>DELETE</c> against <c>Auth.UserAccount</c>: its foreign keys from
/// <c>Auth.UserCredential</c>, <c>Auth.UserVerification</c>, and <c>Social.UserProfile</c> cascade
/// (<c>Social.UserAvatar</c> cascades transitively through <c>Social.UserProfile</c>), so no manual
/// child cleanup is needed. Other tables (posts, comments, photos, follows) reference the
/// account with <c>ON DELETE NO ACTION</c> by design; deleting an account that still has any of
/// those fails with a foreign key violation, which is surfaced as a failed
@@ -204,7 +204,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
{
await connection.ExecuteAsync(
new CommandDefinition(
"DELETE FROM dbo.UserAccount WHERE UserAccountID = @Id",
"DELETE FROM Auth.UserAccount WHERE UserAccountID = @Id",
new { user.Id },
cancellationToken: cancellationToken
)
@@ -273,7 +273,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
/// <inheritdoc />
/// <remarks>
/// For an existing account (<see cref="ApplicationUser.Id" /> already assigned), rotates the
/// credential transactionally -- revoking the previous <c>dbo.UserCredential</c> row(s) and inserting
/// credential transactionally -- revoking the previous <c>Auth.UserCredential</c> row(s) and inserting
/// the new hash -- mirroring the previous <c>AuthRepository.RotateCredentialAsync</c> behavior. During
/// registration <see cref="UserManager{TUser}" /> calls this before the account has an ID (i.e. before
/// <see cref="CreateAsync" /> runs); in that case only the in-memory hash is set, and
@@ -301,7 +301,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
UPDATE dbo.UserCredential
UPDATE Auth.UserCredential
SET IsRevoked = 1, RevokedAt = GETDATE()
WHERE UserAccountId = @UserAccountId AND IsRevoked = 0
""",
@@ -314,7 +314,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.UserCredential (UserAccountId, Hash)
INSERT INTO Auth.UserCredential (UserAccountId, Hash)
VALUES (@UserAccountId, @Hash);
""",
new { UserAccountId = user.Id, Hash = passwordHash },
@@ -423,7 +423,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
SELECT Hash
FROM dbo.UserCredential
FROM Auth.UserCredential
WHERE UserAccountId = @UserAccountId AND IsRevoked = 0
""",
new { UserAccountId = user.Id },
@@ -435,7 +435,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
SELECT TOP 1 1
FROM dbo.UserVerification
FROM Auth.UserVerification
WHERE UserAccountID = @UserAccountId
""",
new { UserAccountId = user.Id },
@@ -459,7 +459,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
SELECT TOP 1 1
FROM dbo.UserVerification
FROM Auth.UserVerification
WHERE UserAccountID = @UserAccountId
""",
new { UserAccountId = userAccountId },
@@ -475,7 +475,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.UserVerification (UserAccountId, VerificationDateTime)
INSERT INTO Auth.UserVerification (UserAccountId, VerificationDateTime)
VALUES (@UserAccountId, GETDATE())
""",
new { UserAccountId = userAccountId },
@@ -489,7 +489,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
}
}
/// <summary>Removes the <c>dbo.UserVerification</c> row for a user, if one exists.</summary>
/// <summary>Removes the <c>Auth.UserVerification</c> row for a user, if one exists.</summary>
private static Task RemoveVerificationRowAsync(
DbConnection connection,
Guid userAccountId,
@@ -497,7 +497,7 @@ public sealed class DapperUserStore(ISqlConnectionFactory connectionFactory)
) =>
connection.ExecuteAsync(
new CommandDefinition(
"DELETE FROM dbo.UserVerification WHERE UserAccountID = @UserAccountId",
"DELETE FROM Auth.UserVerification WHERE UserAccountID = @UserAccountId",
new { UserAccountId = userAccountId },
cancellationToken: cancellationToken
)

View File

@@ -22,7 +22,7 @@ public class UserListRepository(ISqlConnectionFactory connectionFactory)
UserAccountID,
Username,
FirstName, LastName, Email, CreatedAt, UpdatedAt, DateOfBirth, RowVersion
FROM dbo.UserAccount
FROM Auth.UserAccount
WHERE UserAccountID = @UserAccountId
""",
new { UserAccountId = id }
@@ -40,7 +40,7 @@ public class UserListRepository(ISqlConnectionFactory connectionFactory)
return await connection.QueryAsync<UserAccount>(
"""
SELECT UserAccountID, Username, FirstName, LastName, Email, CreatedAt, UpdatedAt, DateOfBirth, RowVersion
FROM dbo.UserAccount
FROM Auth.UserAccount
ORDER BY CreatedAt DESC
OFFSET @Offset ROWS FETCH NEXT @Limit ROWS ONLY
""",

View File

@@ -25,7 +25,7 @@ public class UserProfileRepository(ISqlConnectionFactory connectionFactory)
return await connection.ExecuteScalarAsync<Guid>(
new CommandDefinition(
"""
INSERT INTO dbo.UserProfile (UserAccountID, Biography)
INSERT INTO Social.UserProfile (UserAccountID, Biography)
OUTPUT INSERTED.UserProfileID
VALUES (@UserAccountId, @Biography)
""",
@@ -47,7 +47,7 @@ public class UserProfileRepository(ISqlConnectionFactory connectionFactory)
new CommandDefinition(
"""
SELECT UserProfileID
FROM dbo.UserProfile
FROM Social.UserProfile
WHERE UserAccountID = @UserAccountId
""",
new { UserAccountId = userAccountId },
@@ -73,7 +73,7 @@ public class UserProfileRepository(ISqlConnectionFactory connectionFactory)
int updatedRows = await connection.ExecuteAsync(
new CommandDefinition(
"""
UPDATE dbo.UserProfile
UPDATE Social.UserProfile
SET Biography = @Biography
WHERE UserAccountID = @UserAccountId
""",
@@ -101,7 +101,7 @@ public class UserProfileRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
UPDATE dbo.UserAvatar
UPDATE Social.UserAvatar
SET ValidTo = SYSUTCDATETIME()
WHERE UserProfileID = @UserProfileId AND ValidTo IS NULL
""",
@@ -114,7 +114,7 @@ public class UserProfileRepository(ISqlConnectionFactory connectionFactory)
await connection.ExecuteAsync(
new CommandDefinition(
"""
INSERT INTO dbo.UserAvatar (UserAvatarID, UserProfileID, PhotoID)
INSERT INTO Social.UserAvatar (UserAvatarID, UserProfileID, PhotoID)
VALUES (@UserAvatarId, @UserProfileId, @PhotoId)
""",
new