Skip to content

Commit

Permalink
fix(migrations): 修复初始化迁移数据不全的问题.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinin committed Apr 23, 2024
1 parent 108e53d commit dbc2071
Show file tree
Hide file tree
Showing 60 changed files with 847 additions and 346 deletions.
30 changes: 29 additions & 1 deletion aspnet-core/LINGYUN.MicroService.All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "security", "security", "{9D1302BE-3886-49F8-B0CD-35D2AC1E5A37}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Security", "framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj", "{4C71CA88-0D04-4DDB-8906-B953908B8B8B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Security", "framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj", "{4C71CA88-0D04-4DDB-8906-B953908B8B8B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.Jobs", "modules\task-management\LINGYUN.Abp.BackgroundTasks.Jobs\LINGYUN.Abp.BackgroundTasks.Jobs.csproj", "{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.TaskManagement", "modules\task-management\LINGYUN.Abp.BackgroundTasks.TaskManagement\LINGYUN.Abp.BackgroundTasks.TaskManagement.csproj", "{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TaskManagement.Application.Contracts", "modules\task-management\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj", "{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TaskManagement.HttpApi.Client", "modules\task-management\LINGYUN.Abp.TaskManagement.HttpApi.Client\LINGYUN.Abp.TaskManagement.HttpApi.Client.csproj", "{72D54834-7ADF-4B18-A745-FCBBC255073B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1799,6 +1807,22 @@ Global
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Release|Any CPU.Build.0 = Release|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Release|Any CPU.Build.0 = Release|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Release|Any CPU.Build.0 = Release|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Release|Any CPU.Build.0 = Release|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2141,6 +2165,10 @@ Global
{AAC0C407-B4B9-4E90-99FC-2D793AC229D9} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
{9D1302BE-3886-49F8-B0CD-35D2AC1E5A37} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{4C71CA88-0D04-4DDB-8906-B953908B8B8B} = {9D1302BE-3886-49F8-B0CD-35D2AC1E5A37}
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE} = {77ED7922-BF30-4436-8A85-78F812583913}
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A} = {77ED7922-BF30-4436-8A85-78F812583913}
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE} = {77ED7922-BF30-4436-8A85-78F812583913}
{72D54834-7ADF-4B18-A745-FCBBC255073B} = {77ED7922-BF30-4436-8A85-78F812583913}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}
Expand Down
14 changes: 14 additions & 0 deletions aspnet-core/LINGYUN.MicroService.SingleProject.sln
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.Work.Com
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AuditLogging.Elasticsearch", "framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj", "{66A6E78D-E547-4DD7-9844-087FAB3D03C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.TaskManagement", "modules\task-management\LINGYUN.Abp.BackgroundTasks.TaskManagement\LINGYUN.Abp.BackgroundTasks.TaskManagement.csproj", "{A99F5406-37DC-4677-9166-9BDE90C26CA6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Saas.Jobs", "modules\saas\LINGYUN.Abp.Saas.Jobs\LINGYUN.Abp.Saas.Jobs.csproj", "{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1334,6 +1338,14 @@ Global
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Release|Any CPU.Build.0 = Release|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Release|Any CPU.Build.0 = Release|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1583,6 +1595,8 @@ Global
{C4690A20-8628-4A39-8E71-2D09800D0E72} = {91867618-0D86-4410-91C6-B1166A9ACDF9}
{8233A44F-4DFC-4701-9C04-834FD3C97060} = {91867618-0D86-4410-91C6-B1166A9ACDF9}
{66A6E78D-E547-4DD7-9844-087FAB3D03C2} = {C22741F9-FC56-4AE3-B543-9F15C779D345}
{A99F5406-37DC-4677-9166-9BDE90C26CA6} = {D9C65C9D-8591-46DA-A3EE-419393E607AB}
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3} = {0DF5AD76-AEEA-4052-A6CA-A44C24879F11}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1}
Expand Down
15 changes: 15 additions & 0 deletions aspnet-core/create-database.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off
cls

call .\migrate-db-cmd.bat LY.MicroService.Platform.EntityFrameworkCore platform --ef-u
call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.EntityFrameworkCore admin --ef-u
call .\migrate-db-cmd.bat LY.MicroService.AuthServer.EntityFrameworkCore auth-server --ef-u
call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.EntityFrameworkCore identityserver4-admin --ef-u
call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.EntityFrameworkCore localization --ef-u
call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.EntityFrameworkCore messages --ef-u
call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.EntityFrameworkCore task-management --ef-u
call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.EntityFrameworkCore webhooks-management --ef-u

taskkill /IM dotnet.exe /F

pause
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
6 changes: 4 additions & 2 deletions aspnet-core/migrate-database.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@echo off
cls

call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.AuthServer.DbMigrator auth-server --run
call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.DbMigrator identityserver4-admin --run
call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.DbMigrator localization --run
call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.DbMigrator messages --run
call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.DbMigrator task-management --run
call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.DbMigrator webhooks-management --run
call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run


pause
2 changes: 1 addition & 1 deletion aspnet-core/migrate-db-cmd.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dotnet restore
goto end

:efu
dotnet ef databse update
dotnet ef database update
goto end

:end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
//options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "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"
"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",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
// options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using LINGYUN.Abp.TextTemplating;
using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Features;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;

namespace LY.MicroService.BackendAdmin.DbMigrator;

Expand All @@ -10,4 +16,27 @@ namespace LY.MicroService.BackendAdmin.DbMigrator;
)]
public partial class BackendAdminDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<SettingManagementOptions>(options =>
{
options.IsDynamicSettingStoreEnabled = true;
options.SaveStaticSettingsToDatabase = true;
});
Configure<FeatureManagementOptions>(options =>
{
options.IsDynamicFeatureStoreEnabled = true;
options.SaveStaticFeaturesToDatabase = true;
});
Configure<PermissionManagementOptions>(options =>
{
options.IsDynamicPermissionStoreEnabled = true;
options.SaveStaticPermissionsToDatabase = true;
});
Configure<AbpTextTemplatingCachingOptions>(options =>
{
options.IsDynamicTemplateDefinitionStoreEnabled = true;
options.SaveStaticTemplateDefinitionToDatabase = true;
});
}
}
Loading

0 comments on commit dbc2071

Please sign in to comment.