Add Postgres support to Elsa.Server.Web
Introduced support for PostgreSQL in the Elsa Server configuration and updated the docker-compose to reflect the new database option. Adjusted the dependencies to include the EntityFrameworkCore PostgreSQL project reference.
This commit is contained in:
parent
47d4d20606
commit
3140b72e15
|
|
@ -45,7 +45,7 @@ services:
|
|||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgrespw
|
||||
POSTGRES_DB: elsa
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\modules\Elsa.EntityFrameworkCore.PostgreSql\Elsa.EntityFrameworkCore.PostgreSql.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.MassTransit.AzureServiceBus\Elsa.MassTransit.AzureServiceBus.csproj" />
|
||||
<ProjectReference Include="..\Elsa\Elsa.csproj" />
|
||||
<ProjectReference Include="..\..\common\Elsa.DropIns\Elsa.DropIns.csproj" />
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ using Proto.Persistence.SqlServer;
|
|||
|
||||
const bool useMongoDb = false;
|
||||
const bool useSqlServer = false;
|
||||
const bool usePostgres = false;
|
||||
const bool useDapper = false;
|
||||
const bool useProtoActor = false;
|
||||
const bool useHangfire = false;
|
||||
|
|
@ -39,6 +40,7 @@ var identitySection = configuration.GetSection("Identity");
|
|||
var identityTokenSection = identitySection.GetSection("Tokens");
|
||||
var sqliteConnectionString = configuration.GetConnectionString("Sqlite")!;
|
||||
var sqlServerConnectionString = configuration.GetConnectionString("SqlServer")!;
|
||||
var postgresConnectionString = configuration.GetConnectionString("PostgreSql")!;
|
||||
var mongoDbConnectionString = configuration.GetConnectionString("MongoDb")!;
|
||||
var azureServiceBusConnectionString = configuration.GetConnectionString("AzureServiceBus")!;
|
||||
var rabbitMqConnectionString = configuration.GetConnectionString("RabbitMq")!;
|
||||
|
|
@ -88,6 +90,8 @@ services
|
|||
{
|
||||
if (useSqlServer)
|
||||
ef.UseSqlServer(sqlServerConnectionString!);
|
||||
else if (usePostgres)
|
||||
ef.UsePostgreSql(postgresConnectionString!);
|
||||
else
|
||||
ef.UseSqlite(sqliteConnectionString);
|
||||
});
|
||||
|
|
@ -110,6 +114,8 @@ services
|
|||
{
|
||||
if (useSqlServer)
|
||||
ef.UseSqlServer(sqlServerConnectionString!);
|
||||
else if (usePostgres)
|
||||
ef.UsePostgreSql(postgresConnectionString!);
|
||||
else
|
||||
ef.UseSqlite(sqliteConnectionString);
|
||||
});
|
||||
|
|
@ -128,6 +134,8 @@ services
|
|||
{
|
||||
if (useSqlServer)
|
||||
ef.UseSqlServer(sqlServerConnectionString!);
|
||||
else if (usePostgres)
|
||||
ef.UsePostgreSql(postgresConnectionString!);
|
||||
else
|
||||
ef.UseSqlite(sqliteConnectionString);
|
||||
});
|
||||
|
|
@ -207,6 +215,8 @@ services
|
|||
{
|
||||
if (useSqlServer)
|
||||
ef.UseSqlServer(sqlServerConnectionString);
|
||||
else if (usePostgres)
|
||||
ef.UsePostgreSql(postgresConnectionString);
|
||||
else
|
||||
ef.UseSqlite(sqliteConnectionString);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"Sqlite": "Data Source=App_Data/elsa.sqlite.db;Cache=Shared;",
|
||||
"PostgreSql": "Server=localhost;Username=postgres;Database=elsa;Port=5432;Password=postgrespw;SSLMode=Prefer",
|
||||
"MongoDb": "mongodb://localhost:27017/elsa-workflows",
|
||||
"AzureServiceBus": "",
|
||||
"RabbitMq": "amqp://guest:guest@localhost:5672"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Scheduling.Bookmarks;
|
||||
using Elsa.Scheduling.Contracts;
|
||||
|
|
|
|||
Loading…
Reference in a new issue