1
0
mirror of https://github.com/bitwarden/server synced 2025-12-06 00:03:34 +00:00

[SM-195] Enable legacy timestamp for migrations (#2238)

This commit is contained in:
Oscar Hinton
2022-09-08 10:36:08 +02:00
committed by GitHub
parent b612426782
commit 6a0e134129
2 changed files with 54 additions and 51 deletions

View File

@@ -24,6 +24,9 @@ public class DatabaseContextFactory : IDesignTimeDbContextFactory<DatabaseContex
var globalSettings = GlobalSettingsFactory.GlobalSettings;
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
var connectionString = globalSettings.PostgreSql?.ConnectionString;
// NpgSql 6.0 changed how timezones works. We have not yet updated our projects to support this new behavior and need to fallback to the previous behavior.
// Check https://www.npgsql.org/doc/release-notes/6.0.html#timestamp-rationalization-and-improvements for more details.
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
if (string.IsNullOrWhiteSpace(connectionString))
{
throw new Exception("No Postgres connection string found.");