Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Fix for Timestamp Legacy Behaviour #1030

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System;
using System.Reflection;
using IdentityServer4.EntityFramework.Storage;
using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
Expand All @@ -21,6 +22,7 @@ public static class DatabaseExtensions
/// <typeparam name="TLogDbContext"></typeparam>
/// <typeparam name="TIdentityDbContext"></typeparam>
/// <typeparam name="TAuditLoggingDbContext"></typeparam>
/// <typeparam name="TDataProtectionDbContext"></typeparam>
/// <param name="services"></param>
/// <param name="connectionStrings"></param>
/// <param name="databaseMigrations"></param>
Expand All @@ -42,6 +44,8 @@ public static class DatabaseExtensions
services.AddDbContext<TIdentityDbContext>(options =>
options.UseNpgsql(connectionStrings.IdentityDbConnection, sql => sql.MigrationsAssembly(databaseMigrations.IdentityDbMigrationsAssembly ?? migrationsAssembly)));

AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

// Config DB from existing connection
services.AddConfigurationDbContext<TConfigurationDbContext>(options =>
options.ConfigureDbContext = b =>
Expand Down Expand Up @@ -88,6 +92,8 @@ public static class DatabaseExtensions
{
var migrationsAssembly = typeof(DatabaseExtensions).GetTypeInfo().Assembly.GetName().Name;

AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

// Config DB for identity
services.AddDbContext<TIdentityDbContext>(options => options.UseNpgsql(identityConnectionString, sql => sql.MigrationsAssembly(migrationsAssembly)));

Expand Down