Skip to content

Commit

Permalink
chore: fix pr issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Alxandr committed Oct 7, 2024
1 parent 689c3d8 commit 0d03c37
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ WITH LOGIN
{
await cmd.ExecuteNonQueryAsync(cancellationToken);
}
catch (PostgresException ex) when (ex.SqlState == "42710")
catch (PostgresException ex) when (ex.SqlState == PostgresErrorCodes.DuplicateObject)
{
if (pw.Updated)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CREATE SCHEMA "{_schemaName}"
{
await cmd.ExecuteNonQueryAsync(cancellationToken);
}
catch (PostgresException ex) when (ex.SqlState == "42P06")
catch (PostgresException ex) when (ex.SqlState == PostgresErrorCodes.DuplicateSchema)
{
// Schema already exists
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CREATE DATABASE "{_databaseName}"
{
await cmd.ExecuteNonQueryAsync(cancellationToken);
}
catch (PostgresException ex) when (ex.SqlState == "42P04")
catch (PostgresException ex) when (ex.SqlState == PostgresErrorCodes.DuplicateDatabase)
{
// Database already exists
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
}
else
{
cred = new ManagedIdentityCredential();
var clientId = builder.Configuration.GetValue<string>("ManagedIdentity:ClientId");
if (string.IsNullOrEmpty(clientId))
{
throw new InvalidOperationException("ManagedIdentity:ClientId is required in production mode");
}

cred = new ManagedIdentityCredential(clientId);
}

builder.Services.AddSingleton(cred);
Expand Down

0 comments on commit 0d03c37

Please sign in to comment.