diff --git a/src/providers/WorkflowCore.Persistence.PostgreSQL/MigrationContextFactory.cs b/src/providers/WorkflowCore.Persistence.PostgreSQL/MigrationContextFactory.cs index 582034d42..4424b01cd 100644 --- a/src/providers/WorkflowCore.Persistence.PostgreSQL/MigrationContextFactory.cs +++ b/src/providers/WorkflowCore.Persistence.PostgreSQL/MigrationContextFactory.cs @@ -7,7 +7,7 @@ public class MigrationContextFactory : IDesignTimeDbContextFactory builder) { - builder.ToTable("Subscription", "wfc"); + builder.ToTable("Subscription", _schemaName); builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd(); } protected override void ConfigureWorkflowStorage(EntityTypeBuilder builder) { - builder.ToTable("Workflow", "wfc"); + builder.ToTable("Workflow", _schemaName); builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd(); } protected override void ConfigureExecutionPointerStorage(EntityTypeBuilder builder) { - builder.ToTable("ExecutionPointer", "wfc"); + builder.ToTable("ExecutionPointer", _schemaName); builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd(); } protected override void ConfigureExecutionErrorStorage(EntityTypeBuilder builder) { - builder.ToTable("ExecutionError", "wfc"); + builder.ToTable("ExecutionError", _schemaName); builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd(); } protected override void ConfigureExetensionAttributeStorage(EntityTypeBuilder builder) { - builder.ToTable("ExtensionAttribute", "wfc"); + builder.ToTable("ExtensionAttribute", _schemaName); builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd(); } protected override void ConfigureEventStorage(EntityTypeBuilder builder) { - builder.ToTable("Event", "wfc"); + builder.ToTable("Event", _schemaName); builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd(); } } diff --git a/src/providers/WorkflowCore.Persistence.PostgreSQL/PostgresContextFactory.cs b/src/providers/WorkflowCore.Persistence.PostgreSQL/PostgresContextFactory.cs index de6d0e24d..e0758dfab 100644 --- a/src/providers/WorkflowCore.Persistence.PostgreSQL/PostgresContextFactory.cs +++ b/src/providers/WorkflowCore.Persistence.PostgreSQL/PostgresContextFactory.cs @@ -9,15 +9,17 @@ namespace WorkflowCore.Persistence.PostgreSQL public class PostgresContextFactory : IWorkflowDbContextFactory { private readonly string _connectionString; + private readonly string _schemaName; - public PostgresContextFactory(string connectionString) + public PostgresContextFactory(string connectionString, string schemaName) { _connectionString = connectionString; + _schemaName = schemaName; } public WorkflowDbContext Build() { - return new PostgresContext(_connectionString); + return new PostgresContext(_connectionString,_schemaName); } } } diff --git a/src/providers/WorkflowCore.Persistence.PostgreSQL/ServiceCollectionExtensions.cs b/src/providers/WorkflowCore.Persistence.PostgreSQL/ServiceCollectionExtensions.cs index 26abb29ce..bf1bac81f 100644 --- a/src/providers/WorkflowCore.Persistence.PostgreSQL/ServiceCollectionExtensions.cs +++ b/src/providers/WorkflowCore.Persistence.PostgreSQL/ServiceCollectionExtensions.cs @@ -10,9 +10,10 @@ namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions { - public static WorkflowOptions UsePostgreSQL(this WorkflowOptions options, string connectionString, bool canCreateDB, bool canMigrateDB) + public static WorkflowOptions UsePostgreSQL(this WorkflowOptions options, + string connectionString, bool canCreateDB, bool canMigrateDB, string schemaName="wfc") { - options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new PostgresContextFactory(connectionString), canCreateDB, canMigrateDB)); + options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new PostgresContextFactory(connectionString, schemaName), canCreateDB, canMigrateDB)); return options; } } diff --git a/src/providers/WorkflowCore.Persistence.PostgreSQL/WorkflowCore.Persistence.PostgreSQL.csproj b/src/providers/WorkflowCore.Persistence.PostgreSQL/WorkflowCore.Persistence.PostgreSQL.csproj index e210a8b55..484dc6941 100644 --- a/src/providers/WorkflowCore.Persistence.PostgreSQL/WorkflowCore.Persistence.PostgreSQL.csproj +++ b/src/providers/WorkflowCore.Persistence.PostgreSQL/WorkflowCore.Persistence.PostgreSQL.csproj @@ -15,9 +15,9 @@ false false Provides support to persist workflows running on Workflow Core to a PostgreSQL database. - 2.0.0 - 2.0.0.0 - 2.0.0.0 + 2.0.1 + 2.0.1.0 + 2.0.1.0 diff --git a/test/WorkflowCore.Tests.PostgreSQL/PostgresPersistenceProviderFixture.cs b/test/WorkflowCore.Tests.PostgreSQL/PostgresPersistenceProviderFixture.cs index 21215f61d..95ebe7976 100644 --- a/test/WorkflowCore.Tests.PostgreSQL/PostgresPersistenceProviderFixture.cs +++ b/test/WorkflowCore.Tests.PostgreSQL/PostgresPersistenceProviderFixture.cs @@ -19,7 +19,7 @@ public class PostgresPersistenceProviderFixture : BasePersistenceFixture public PostgresPersistenceProviderFixture(PostgresDockerSetup dockerSetup, ITestOutputHelper output) { output.WriteLine($"Connecting on {PostgresDockerSetup.ConnectionString}"); - _subject = new EntityFrameworkPersistenceProvider(new PostgresContextFactory(PostgresDockerSetup.ConnectionString), true, true); + _subject = new EntityFrameworkPersistenceProvider(new PostgresContextFactory(PostgresDockerSetup.ConnectionString,"wfc"), true, true); _subject.EnsureStoreExists(); } }