Browse Source

feat: 更新数据库连接字符串和时区配置

- 修改多个配置文件以更新数据库连接字符串
- 添加本地时区设置
- 调整服务配置以支持 PostgreSQL
- 移除各个模块独立的数据库配置,使其支持当项目启动数据迁移
pull/1048/head
feijie 1 year ago
parent
commit
70d5949058
  1. 12
      aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/SingleDbMigratorModule.Configure.cs
  2. 7
      aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/SingleDbMigratorModule.cs
  3. 19
      aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.Development.json
  4. 19
      aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.PostgreSql.json
  5. 22
      aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json
  6. 14
      aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql/SingleMigrationsDbContextFactory.cs
  7. 2
      aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql/SingleMigrationsEntityFrameworkCorePostgreSqlModule.cs
  8. 1
      aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs
  9. 19
      aspnet-core/services/LY.MicroService.Applications.Single/appsettings.Development.json
  10. 19
      aspnet-core/services/LY.MicroService.Applications.Single/appsettings.PostgreSql.json
  11. 3
      aspnet-core/services/LY.MicroService.Applications.Single/appsettings.json

12
aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/SingleDbMigratorModule.Configure.cs

@ -1,4 +1,14 @@
namespace LY.MicroService.Applications.Single.DbMigrator;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Timing;
namespace LY.MicroService.Applications.Single.DbMigrator;
public partial class SingleDbMigratorModule
{
private void ConfigureTiming(IConfiguration configuration)
{
Configure<AbpClockOptions>(options =>
{
configuration.GetSection("Clock").Bind(options);
});
}
}

7
aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/SingleDbMigratorModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.UI.Navigation.VueVbenAdmin;
using Microsoft.Extensions.DependencyInjection;
#if POSTGRESQL
using LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql;
#else
@ -20,5 +21,9 @@ namespace LY.MicroService.Applications.Single.DbMigrator;
)]
public partial class SingleDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
ConfigureTiming(configuration);
}
}

19
aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.Development.json

@ -36,24 +36,7 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpAuditLogging": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpOpenIddict": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpTenantManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AppPlatform": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"TaskManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"Workflow": "Server=127.0.0.1;Database=Workflow-V70;User Id=root;Password=123456;SslMode=None",
"Notifications": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None",
"MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None",
"Demo": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
},
"DistributedLock": {
"IsEnabled": true,

19
aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.PostgreSql.json

@ -36,24 +36,7 @@
}
},
"ConnectionStrings": {
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpAuditLogging": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpOpenIddict": "Host=127.0.0.1;Database=IdentityServer-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpIdentity": "Host=127.0.0.1;Database=IdentityServer-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpIdentityServer": "Host=127.0.0.1;Database=IdentityServer-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpSaas": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpTenantManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpFeatureManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpSettingManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpPermissionManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpLocalizationManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpTextTemplating": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AppPlatform": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"TaskManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"Workflow": "Host=127.0.0.1;Database=Workflow-V70;Username=postgres;Password=123456;SslMode=Prefer",
"Notifications": "Host=127.0.0.1;Database=Messages-V70;Username=postgres;Password=123456;SslMode=Prefer",
"MessageService": "Host=127.0.0.1;Database=Messages-V70;Username=postgres;Password=123456;SslMode=Prefer",
"Demo": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer"
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer"
},
"DistributedLock": {
"IsEnabled": true,

22
aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json

@ -1,23 +1,9 @@
{
"Clock": {
"Kind": "Local"
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpAuditLogging": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpOpenIddict": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpTenantManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AppPlatform": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"TaskManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"Workflow": "Server=127.0.0.1;Database=Workflow-V70;User Id=root;Password=123456;SslMode=None",
"Notifications": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None",
"MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None",
"Demo": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",

14
aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql/SingleMigrationsDbContextFactory.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql;
@ -13,7 +14,8 @@ public class SingleMigrationsDbContextFactory : IDesignTimeDbContextFactory<Sing
var connectionString = configuration.GetConnectionString("Default");
var builder = new DbContextOptionsBuilder<SingleMigrationsDbContext>()
.UseNpgsql(connectionString, b => b.MigrationsAssembly("LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql"));
.UseNpgsql(connectionString,
b => b.MigrationsAssembly("LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql"));
return new SingleMigrationsDbContext(builder!.Options);
}
@ -21,12 +23,12 @@ public class SingleMigrationsDbContextFactory : IDesignTimeDbContextFactory<Sing
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../LY.MicroService.Applications.Single.DbMigrator/"))
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(),
"../LY.MicroService.Applications.Single.DbMigrator/"))
.AddJsonFile("appsettings.json", optional: false)
#if POSTGRESQL
.AddJsonFile("appsettings.PostgreSql.json", optional: false)
#endif
.AddJsonFile("appsettings.Development.json", optional: true);
.AddJsonFile(
"appsettings.PostgreSql.json",
optional: false);
return builder.Build();
}

2
aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql/SingleMigrationsEntityFrameworkCorePostgreSqlModule.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.PostgreSql;
using Volo.Abp.Modularity;
@ -17,6 +18,7 @@ public class SingleMigrationsEntityFrameworkCorePostgreSqlModule : AbpModule
Configure<AbpDbContextOptions>(options =>
{
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
options.UseNpgsql();
});
}

1
aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs

@ -572,6 +572,7 @@ public partial class MicroServiceApplicationsSingleModule
{
#if POSTGRESQL
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
options.UseNpgsql();
#else
options.UseMySQL();

19
aspnet-core/services/LY.MicroService.Applications.Single/appsettings.Development.json

@ -36,24 +36,7 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpAuditLogging": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpOpenIddict": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpTenantManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"AppPlatform": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"TaskManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None",
"Workflow": "Server=127.0.0.1;Database=Workflow-V70;User Id=root;Password=123456;SslMode=None",
"Notifications": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None",
"MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None",
"Demo": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
},
"DistributedLock": {
"IsEnabled": true,

19
aspnet-core/services/LY.MicroService.Applications.Single/appsettings.PostgreSql.json

@ -36,24 +36,7 @@
}
},
"ConnectionStrings": {
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpAuditLogging": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpOpenIddict": "Host=127.0.0.1;Database=IdentityServer-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpIdentity": "Host=127.0.0.1;Database=IdentityServer-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpIdentityServer": "Host=127.0.0.1;Database=IdentityServer-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpSaas": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpTenantManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpFeatureManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpSettingManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpPermissionManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpLocalizationManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AbpTextTemplating": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"AppPlatform": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"TaskManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer",
"Workflow": "Host=127.0.0.1;Database=Workflow-V70;Username=postgres;Password=123456;SslMode=Prefer",
"Notifications": "Host=127.0.0.1;Database=Messages-V70;Username=postgres;Password=123456;SslMode=Prefer",
"MessageService": "Host=127.0.0.1;Database=Messages-V70;Username=postgres;Password=123456;SslMode=Prefer",
"Demo": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer"
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer"
},
"DistributedLock": {
"IsEnabled": true,

3
aspnet-core/services/LY.MicroService.Applications.Single/appsettings.json

@ -1,4 +1,7 @@
{
"Clock": {
"Kind": "Local"
},
"Forwarded": {
"ForwardedHeaders": "XForwardedFor,XForwardedProto"
},

Loading…
Cancel
Save